Skip to main content

Shrink Proxmox LXC Storage

  1. Shut down the LXC:

    pct stop 102
  2. Find the storage volume name:

    lvdisplay | grep "LV Path\|LV Name" | grep 102
  3. Check free space:

    pct df 102
  4. Resize it:

    resize2fs /dev/pve/vm-102-disk-0 15G
  5. Check the filesystem:

    e2fsck -fy /dev/pve/vm-102-disk-0
  6. Resize the LV:

    lvreduce -L 15G /dev/pve/vm-102-disk-0
  7. Mount the drive and show the mount point:

    pct mount 102
  8. Trim the filesystem using the mount path shown:

    fstrim -v /var/lib/lxc/102/rootfs
  9. Unmount it:

    pct unmount 102
  10. At this point a warning like this may appear:

    WARNING: Thin volume pve/vm-102-disk-0 maps 262296436736 while the size is only 16106127360.

    The only thing that could make this work was to backup/restore it via the GUI. The ZFS mount was removed and re-added because a warning said it would erase mountpoints and it didn't seem worth the risk.