2016-09-19 21:16:17 +05:30
|
|
|
# qemu-img
|
|
|
|
|
2024-02-14 17:25:13 -03:00
|
|
|
> Create and manipulate Quick Emulator Virtual HDD images.
|
2024-05-22 21:51:44 +02:00
|
|
|
> More information: <https://qemu.readthedocs.io/en/master/tools/qemu-img.html>.
|
2016-09-19 21:16:17 +05:30
|
|
|
|
|
|
|
- Create disk image with a specific size (in gigabytes):
|
|
|
|
|
2025-07-05 18:41:49 +07:00
|
|
|
`qemu-img create {{path/to/image_file.img}} {{gigabytes}}G`
|
2016-09-19 21:16:17 +05:30
|
|
|
|
|
|
|
- Show information about a disk image:
|
|
|
|
|
2025-07-05 18:41:49 +07:00
|
|
|
`qemu-img info {{path/to/image_file.img}}`
|
2016-09-19 21:16:17 +05:30
|
|
|
|
|
|
|
- Increase or decrease image size:
|
|
|
|
|
2025-07-05 18:41:49 +07:00
|
|
|
`qemu-img resize {{path/to/image_file.img}} {{gigabytes}}G`
|
2016-09-19 21:16:17 +05:30
|
|
|
|
|
|
|
- Dump the allocation state of every sector of the specified disk image:
|
|
|
|
|
2025-07-05 18:41:49 +07:00
|
|
|
`qemu-img map {{path/to/image_file.img}}`
|
2019-10-05 13:39:24 +03:00
|
|
|
|
2025-07-05 18:41:49 +07:00
|
|
|
- Convert a VMware `.vmdk` disk image to a KVM `.qcow2` disk image:
|
2019-10-05 13:39:24 +03:00
|
|
|
|
2025-07-05 18:41:49 +07:00
|
|
|
`qemu-img convert -f vmdk -O qcow2 {{path/to/image_file.vmdk}} {{path/to/image_file.qcow2}}`
|
|
|
|
|
|
|
|
- [c]reate an internal snapshot of a KVM `.qcow2` disk image:
|
|
|
|
|
|
|
|
`qemu-img snapshot -c {{snapshot_tag_name}} {{path/to/image_file.qcow2}}`
|
|
|
|
|
|
|
|
- [a]pply an internal snapshot to a KVM `.qcow2` disk image:
|
|
|
|
|
|
|
|
`qemu-img snapshot -a {{snapshot_tag_name}} {{path/to/image_file.qcow2}}`
|