Resize a virtual disk
If an existing disk image requires additional space, you can use the qemu-img resize utility to change the size of the image to fit your use case.
Before you begin
- You have created a backup of the disk image.
- Any virtual machines (VMs) that use the disk image must be shut down.
Warning Resizing the disk image of a running VM can cause data corruption or other issues.
- The hard disk of the host has sufficient free space for the intended disk image size.
- Optional: You have ensured that the disk image does not have data corruption or similar problems. For instructions, see Checking the consistency of a virtual disk.
Procedure
Results
- Display information about the resized image and see if it has the intended size:
# 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 - Check the resized disk image for potential errors. For instructions, see Checking the consistency of a virtual disk.