12.6.
12.6.1.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img create -f <format> <image-name> <size>
# qemu-img create -f <format> <image-name> <size>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img create -f qcow2 test-image 30G
# qemu-img create -f qcow2 test-image 30G Formatting 'test-img', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=32212254720 lazy_refcounts=off refcount_bits=16
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img info <test-img>
# qemu-img info <test-img> image: test-img file format: qcow2 virtual size: 30 GiB (32212254720 bytes) disk size: 196 KiB cluster_size: 65536 Format specific information: compat: 1.1 compression type: zlib lazy refcounts: false refcount bits: 16 corrupt: false extended l2: false
12.6.2.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img check <test-name.qcow2>
# qemu-img check <test-name.qcow2> No errors were found on the image. 327434/327680 = 99.92% allocated, 0.00% fragmented, 0.00% compressed clusters Image end offset: 21478375424
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 167 errors were found on the image. Data may be corrupted, or further writes to the image may corrupt it. 453368 leaked clusters were found on the image. This means waste of disk space, but no harm to data. 259 internal errors have occurred during the check. Image end offset: 21478375424
167 errors were found on the image. Data may be corrupted, or further writes to the image may corrupt it. 453368 leaked clusters were found on the image. This means waste of disk space, but no harm to data. 259 internal errors have occurred during the check. Image end offset: 21478375424
- 警告
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img check -r all <test-name.qcow2>
# qemu-img check -r all <test-name.qcow2> [...] 122 errors were found on the image. Data may be corrupted, or further writes to the image may corrupt it. 250 internal errors have occurred during the check. Image end offset: 27071414272
12.6.3.
- 警告
Copy to Clipboard Copied! Toggle word wrap Toggle overflow virsh domblklist <vm-name>
# virsh domblklist <vm-name> Target Source ---------------------------------------------------------- vda /home/username/disk-images/example-image.qcow2
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cp <example-image.qcow2> <example-image-backup.qcow2>
# cp <example-image.qcow2> <example-image-backup.qcow2>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img resize <example-image.qcow2> +10G
# qemu-img resize <example-image.qcow2> +10G
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img info <converted-image.qcow2>
# qemu-img info <converted-image.qcow2> image: converted-image.qcow2 file format: qcow2 virtual size: 30 GiB (32212254720 bytes) disk size: 196 KiB cluster_size: 65536 Format specific information: compat: 1.1 compression type: zlib lazy refcounts: false refcount bits: 16 corrupt: false extended l2: false
12.6.4.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img convert -f raw <original-image.img> -O qcow2 <converted-image.qcow2>
# qemu-img convert -f raw <original-image.img> -O qcow2 <converted-image.qcow2>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow qemu-img info <converted-image.qcow2>
# qemu-img info <converted-image.qcow2> image: converted-image.qcow2 file format: qcow2 virtual size: 30 GiB (32212254720 bytes) disk size: 196 KiB cluster_size: 65536 Format specific information: compat: 1.1 compression type: zlib lazy refcounts: false refcount bits: 16 corrupt: false extended l2: false
12.6.5.