How Can We Help?
Resize a Proxmox Container
Did you increase the size of a Proxmox Container and is it too big now? Or did you create Proxmox Container which turns out double the needed size? This article will explain how to reduce the size of your Proxmox Container
Prerequisites
In this scenario we have Proxmox installed on a ZFS file system, therefore, results with different file systems are not guaranteed.
Resize Container Size
Start by stopping your container using pct stop __CONTAINER_ID__
.
To find the disk name of your container use lvdisplay | grep "LV Path\|LV Size" | grep __CONTAINER_ID__
.
Optionally, you can run a file system check using e2fsck -fy __DISK_PATH__
.
To reduce the file system use resize2fs __DISK_PATH__ 8G
.
Now reduce the volume size using lvreduce -L 8G __DISK_PATH__
.
Next, you have to trim the volume. To do this create a temporary folder in /tmp
, then mount it using mount __DISK_PATH__ /tmp/__FOLDER__
.
Now run fstrim
to trim the volume using fstrim -v /tmp/__FOLDER__
.
Once this is done do not forget to unmount using umount
.
Update the disk size in the container configuration file found at /etc/pve/lxc/__CONTAINER_ID__
.
Start the container using pct start __CONTAINER_ID__
.