meta data for this page
  •  

Shrink VM disc image

Shrinking is not supported by Proxmox

QEMU is not capable to resize ZFS raw data.

Workaround:

  • Shrink disc in guest OS (i.e. using gparted to a bit smaller than desired block device size)
  • Change VM disc size. Two ways:
  • 1) Clean and safe (but long):
    • Move disk to QCOW2 file on local (dir) storage.
    • Set new disk size
      qemu-img resize --shrink /var/lib/vz/images/703/vm-703-disk-0.qcow2 6G
  • 2) Directly change ZFS volume size:
    • zfs set volsize=4GB hddpool/data/vm-123-0
  • Edit machine config file and set new size:
    scsi1: rbd:vm-703-disk-2,backup=0,cache=writeback,discard=on,size=6G