How can I shrink a ZFS / RAW disk?

Razva

Renowned Member
Dec 3, 2013
252
10
83
Romania
cncted.com
Hey,

I have a 1TB RAW disk (rpool/data/vm-101-disk-0) on a ZFS pool (local-zfs) that I want to shrink to 256 GB. The VM uses cloud-init.

The real usage is about 15 GB, so there's plenty of space to shrink.

I've tried to do a zfs set volsize=256G rpool/data/vm-101-disk-0 which works, but the OS breaks. So then I tried to boot the VM with a LiveCD, resize /dev/sda1 to 100 GB and to the zfs set volsize. The OS breaks.

Can you please let me know how to do it? I can convert to QCOW if necessary.

Thank you!
 
Before you attempt to reduce the underlying disk you first need to understand if the filesystem inside your VM can handle reduction.
Shrinking the filesystem is always a sensitive topic, some filesystems can be shrunk safely, others cant.
At a high level, starting from inside the VM: shrink the filesystem, reduce the partition, then attempt to shrink the disk.
Almost none of it is PVE specific, plug each piece with identifying information (xfs,ext[2-4),etc) into google and make sure you have backups.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: noko