AS201281 Wiki

Your check engine light is on!

User Tools

Site Tools


misc:smaller-qcow2

Shrink Qcow2 Disk Files

Linux Guest Preparation

Use the following command to zero out your disk (inside the VM):

# dd if=/dev/zero of=/mytempfile
# rm -f /mytempfile

Shrink the Disk File

Shut down the VM.

Create a backup of your existing VM disk file:
# mv image.qcow2 image.qcow2_backup

There are 2 options, one with compression and another without.

Option #1: No Compression

# qemu-img convert -O qcow2 image.qcow2_backup image.qcow2

Option #2: With Compression (performance impact on slower systems)

# qemu-img convert -O qcow2 -c image.qcow2_backup image.qcow2

Boot your VM and verify all is working.

misc/smaller-qcow2.txt · Last modified: 2021/01/04 20:41 by 127.0.0.1