User Tools

Site Tools


docu:csheet:sysadm:venv:qemu:shrink_qcow2_img

Shrink a qcow2 image file using qemu-img tool


In case you did allocate more than you needed, and want to get some disk space back, you can use this command on a qcow2 image, to shrink it.

# using a low priority is recommended, otherwise your host machine becomes unusable
nice -n 19 qemu-img convert -O qcow2 ubuntu.qcow2 ubuntu.new.qcow2
 
# search the process on another terminal, 
# and also apply a low io priority using ionice
ionice -n 7 -p `pgrep qemu-img | head -n1`
docu/csheet/sysadm/venv/qemu/shrink_qcow2_img.txt · Last modified: 2020/08/21 10:03 by admin