First, shut down the container and ensure it’s not running.
List out the LVM logical volumes:
- lvdisplay | grep "LV Path\|LV Size"
Choose the disk you want to resize – you’ll see they’re named by container ID and disk number. For example, /dev/vg0/vm-205-disk-1.
Check and fix the filesystem, just incase:
- e2fsck -fy /dev/vg0/vm-205-disk-1
Resize the file system. It is advisable, at this point, to set this to 1GB smaller than you actually want it (e.g. 7G when you want 8G):
- resize2fs /dev/vg0/vm-205-disk-1 7G
Resize the LVM LV to the actual size you want it to be:
- lvreduce -L 8G /dev/vg0/vm-205-disk-1
Resize the file system to fill the LVM LV:
- resize2fs /dev/vg0/vm-205-disk-1
Finally, edit the configuration for the container such that Proxmox reports the correct size for the disk. You will find this at /etc/pve/lxc/205.conf where 205 is your container ID.
You can now start your container and check the disks’ sizes:
- df -h