I googled a lot and couldn't find these steps in one place. I beat my head on the wall a bunch with this so I thought others might find this useful. This is how I successfully reduced the boot disk size on Ubuntu.
There's an order of operations that's important:
1. Reduce the filesystem size
2. Reduce the LV size (slightly larger)
3. Reduce the partition (a bit larger yet)
4. Rightsize the pv
5. Reduce the disk size (the largest of all).
6. If desired, expand everything back out to fill the disk.
There's an order of operations that's important:
1. Reduce the filesystem size
2. Reduce the LV size (slightly larger)
3. Reduce the partition (a bit larger yet)
4. Rightsize the pv
5. Reduce the disk size (the largest of all).
6. If desired, expand everything back out to fill the disk.
Code:
# boot live CD to shell
e2fsck -fy /dev/mapper/ubuntu--vg-ubuntu--lv
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv 28G # smallest size, aim low - you can expand back up later.
lvreduce -L 29G /dev/mapper/ubuntu--vg-ubuntu--lv # slightly bigger
parted /dev/sda
resizepart 3 35436 # 31Gib + 2150 offset from start of disk. lsblk is base2 while parted is base10
quit
pvresize /dev/sda # refits the PV to the partition
# Shutdown VM, switch to proxmox:
lvreduce -L 35G /dev/pve/disk-name # Remember, the disk needs to cover all partions. E.g. boot is 2GB. Give healthy buffer, you can expand into it.
qm rescan --vmid 103
#Back into rescue to fix partition table
gdisk /dev/sda
x #expert (lol, thats me)
e # relocate backup partition table to end of the disk
w # write
# Boot into VM. Expand LV and FS to utilize slack space.