2021年 06月 20日
SLES15 と openSUSE 15 では KVMの仮想マシンの Raw フォーマットが違う
# qemu-img info myvm.img
opensuse15:~ # qemu-img info /var/lib/libvirt/images/vm01/vm01.disk0.rawimage: /var/lib/libvirt/images/vm01/vm01.disk0.rawfile format: rawvirtual size: 20 GiB (21478375424 bytes)disk size: 20 GiBopensuse15:~ #
sles15:~ # ls /var/lib/libvirt/images/zm001/zm001.disk1.raw -lh-rw------- 1 qemu qemu 26G Jun 20 17:22 /var/lib/libvirt/images/zm001/zm001.disk1.rawsles15:~ # qemu-img info /var/lib/libvirt/images/zm001/zm001.disk1.rawimage: /var/lib/libvirt/images/zm001/zm001.disk1.rawfile format: rawvirtual size: 25G (26847870976 bytes)disk size: 21Gsles15:~ #
sles15:~ # qemu-img create -f raw vmimg.system.raw 4GFormatting 'vmimg.system.raw', fmt=raw size=4294967296sles15:~ # ls vmimg.system.raw -lh-rw-r--r-- 1 root root 4.0G Jun 20 18:24 vmimg.system.rawsles15:~ # qemu-img info vmimg.system.rawimage: vmimg.system.rawfile format: rawvirtual size: 4.0G (4294967296 bytes)disk size: 0sles15:~ #
sles15:/ssd/test # dd if=/dev/zero of=vmimg.system.raw bs=1024M count=1010+0 records in10+0 records out10737418240 bytes (11 GB, 10 GiB) copied, 48.7019 s, 220 MB/ssles15:/ssd/test # qemu-img info vmimg.system.rawimage: vmimg.system.rawfile format: rawvirtual size: 10G (10737418240 bytes)disk size: 10Gsles15:/ssd/test #
# cp --sparse=always source_file new_file# rsync --sparse source_file new_file