- 积分
- 16844
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
动态挂载硬盘) I5 c2 j* ]; C' E% y
8 u* E* z3 ? y8 N1 f# u5 p8 B. F& ~: zvirsh list 4 L: ~) i( X2 x5 r/ w8 {, ?
Id Name State# p* B+ k3 D7 J" h3 b& z
---------------------------------
6 ^% A+ y* Q3 V
- j) t" R3 p+ f2 q( e* ~. A 9 Windows2019_x86 running" B/ F! y$ N) p" V. S5 V
, V! |1 J* d9 k( k5 ]0 Z
. W2 q4 A% }% t2 z
% [; j: d8 r# t% H7 E) n
编辑挂在硬盘xml4 |9 F' X9 H" @
vim attach.xml
& x/ y. Z9 q; E& |* b }6 w5 j<disk type='file' device='disk'>. a- y4 \! s$ g+ S5 B. A
<driver name='qemu' type='qcow2'/>) U! N' N. {$ X: e2 b% E; f
<source file='/usr/src/CloudbaseInitSetup_1_1_2_x86.msi.iso'/>+ q$ y2 L2 b7 U0 G/ Y
<target dev='sdc' bus='virtio'/>
4 l* p" V% a( g y4 e% |/ n8 L5 t</disk>
0 q! a& S4 m6 ]9 c
1 M, |8 |; L. M/ _- z r+ z% l% w% k) K+ J! g8 s: V
使用命令挂载
. M5 R M/ q3 a% H S, T
G E1 G% Q6 e. F6 y$ N) isudo virsh attach-device Windows2019_x86 attach.xml
) Z H0 j7 Y" P8 \, W- _( N6 y3 Y/ D; i) l" q( `$ N$ \+ b# o
, \# l7 Q$ `3 }' c' A
1 p$ S% T2 j/ n) c$ avirsh attach-device Windows2019_x86 attach.xml " P2 h: V) P+ {+ v
error: Failed to attach device from attach.xml
. f: T& _, ~& T& P+ kerror: internal error: unable to execute QEMU command 'blockdev-add': Image is not in qcow2 format
' t+ t, m- q7 |
5 {! T/ x* j3 J$ Y; r7 ~8 s/ j" S; T S1 @
修改
7 O1 T: T- T0 V4 [0 z- C7 tvim attach.xml 2 U# `: C7 {8 b" F- G- d B
<disk type='file' device='disk'>% D0 t8 I( v, D" S
<driver name='qemu' type='raw'/>
; ~) o# h; V+ K% [, ] <source file='/usr/src/CloudbaseInitSetup_1_1_2_x86.msi.iso'/>
' o) p9 |/ ~1 \+ K% T. @ <target dev='sdc' bus='virtio'/>: U/ k4 `5 U/ e2 e! L# I
</disk>8 n1 m/ a0 u8 f! m+ N4 n; A
) m" m! O. C B4 V. L. o, e, E) |( _; x* }
root@compute01:/usr/src# virsh attach-device Windows2019_x86 attach.xml
0 F- ^9 k( i6 s) D8 A/ _8 ~0 @Device attached successfully X, H5 h' V* x9 o0 y
4 q( _7 Y$ ~! K: Y5 c# r5 y为了马上识别到文件信息:
' a0 S4 y% c4 [7 P* H
" ^' n! `1 ?5 K* B, p* v <disk type='file' device='cdrom'>
# n, c) E8 q# Z) J0 w" \( g4 [ <driver name='qemu' type='raw'/>1 y5 H: L; J8 ^8 H
<source file='/usr/src/CloudbaseInitSetup_1_1_2_x86.msi.iso'/>$ V6 u( }2 [! P
<target dev='sdc' bus='sata'/>+ B6 h5 E6 F Z% O
<readonly/>
1 T" _. A: |5 w$ x: [4 x) T <address type='drive' controller='0' bus='0' target='0' unit='1'/>8 N5 ~0 T W0 |6 z
</disk>0 R/ L3 c: r G
; P8 U; X5 u; d: @+ T0 p4 A- W K$ O7 y3 O9 M0 W
|
|