Increase LXC Disk Size in Proxmox

Janne Kemppainen |

I noticed that I had only allocated 8G of storage for my Paperless-ngx LXC container running on Proxmox. Thankfully, increasing the amount is super easy!

Increase disk size using the command line

The quick answer is to SSH in to your Proxmox host and run the pct resize command with the new (larger) size of the disk you want to resize. The pct command is a Proxmox utility that allows you to manage LXC containers from the command line.

The format of the command is pct resize <vmid> <disk> <size>. In my case, I wanted to increase my Paperless-ngx container (ID 108) root disk size to 20G.

root@proxmox:~# pct resize 108 rootfs 20G
  Size of logical volume pve/vm-108-disk-0 changed from 8.00 GiB (2048 extents) to 20.00 GiB (5120 extents).
  Logical volume pve/vm-108-disk-0 successfully resized.
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/pve/vm-108-disk-0 is mounted on /tmp; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 3
The filesystem on /dev/pve/vm-108-disk-0 is now 5242880 (4k) blocks long.

That’s it! The disk size has been increased. You can verify this by logging into the LXC container and running df -h to see the new size.

root@proxmox:~# pct enter 108
root@paperless-ngx:~# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/pve-vm--108--disk--0   20G  6.4G   13G  34% /
none                              492K  4.0K  488K   1% /dev
udev                              4.8G     0  4.8G   0% /dev/tty
tmpfs                             4.8G   20K  4.8G   1% /dev/shm
tmpfs                             2.0G  120K  2.0G   1% /run
tmpfs                             5.0M     0  5.0M   0% /run/lock

Increase disk size using the Proxmox web interface

An alternative way to increase the disk size is to use the Proxmox web interface. Navigate to the Datacenter view, select the LXC container you want to resize, and click the Resources tab. Select the disk that you want to resize, after which the Volume Action button becomes available.

LXC Resources view

Click the button and select Resize. Enter the amount of extra space you want to add to the disk and click Resize disk. The disk will be resized, and the UI should reflect the new size.

Subscribe to my newsletter

What’s new with PäksTech? Subscribe to receive occasional emails where I will sum up stuff that has happened at the blog and what may be coming next.

powered by TinyLetter | Privacy Policy