- VM내에서 디스크 상태확인
# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f24d6
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13055 104856576 83 Linux
- 100G 디스크 생성
# qemu-img create -f qcow2 SECOND_100G.qcow2 100G
Formatting '100G.qcow2', fmt=qcow2 size=107374182400 encryption=off cluster_size=65536 lazy_refcounts=off
- QMP 접속
# socat - UNIX-CONNECT:/VM_DISK/HDs/VM1/vm04020.monitor
- 디스크정보 확인
(qemu) info block
info block
scsi0-hd0: removable=0 io-status=ok file=/VM_DISK/HDs/VM1/FIRST_HDD.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=1000 iops_rd=0 iops_wr=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
현재 VM에서는 1개의 디스크가 SCSI 형태로 물려있음
- 100G.qcow2로 생성한 디스크를 연결
# (qemu) pci_add auto storage file=/VM_DISK/HDs/VM1/SECOND_100G.qcow2,if=scsi
pci_add auto storage file=/VM_DISK/HDs/VM1/SECOND_100G.qcow2,if=scsi
OK domain 0, bus 0, slot 5, function 0
(qemu) info block
info block
scsi0-hd0: removable=0 io-status=ok file=/VM_DISK/HDs/VM1/FIRST_HDD.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=1000 iops_rd=0 iops_wr=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
scsi0-hd1: removable=0 io-status=ok file=/VM_DISK/HDs/VM1/SECOND_100G.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
==>SCSI형태로 연결한 두번째 디스크는 scsi0-hd1 디바이스명으로 자동으로 연결
※ PCI 장치 추가/삭제
pci_add auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]... -- hot-add PCI device
pci_del [[<domain>:]<bus>:]<slot> -- hot remove PCI device
- VM내에서 디스크 상태확인
# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f24d6
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13055 104856576 83 Linux
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
- 생성 추가디스크 삭제
확인중
removable=0
removable=1