Categories
proxmox

Shrink Proxmox/Qemu Virtual Hard Disk


Before:
[email protected]:/mnt/pve/local-media/images/101# qemu-img info vm-101-disk-1.qcow2
image: vm-101-disk-1.qcow2
file format: qcow2
virtual size: 869 GiB (933081645056 bytes)
disk size: 120 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false

After:
[email protected]:/mnt/pve/local-media/images/101# qemu-img info vm-101-disk-1.qcow2 image: vm-101-disk-1.qcow2
file format: qcow2
virtual size: 200 GiB (214748364800 bytes)
disk size: 120 GiB
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false


1. Zero out free space
sdelete -z d:

2. shrink partition within guest OS
> Windows Disk right click, shrink

3. Shut down VM

4. Shrink .qcow2 image
> qemu-img resize vm-101-disk-1.qcow2 –shrink -669G
> Image resized.

5. Edit proxmox description
> nano /etc/pve/qemu-server/101.conf

Leave a Reply

Your email address will not be published.