How to Resize an LXC Container on Proxmox VE
Step-by-step guide to resizing LXC container disk, CPU, and memory on Proxmox VE using pct commands. Covers online resize, mount points, and shrinking workarounds.
When You Need to Resize a Container
Containers grow. A database fills up, an application needs more memory, or a service needs more CPU cores to handle increased traffic. Proxmox makes it straightforward to resize LXC containers, and in most cases you can do it without any downtime.
Resizing the Root Disk
The most common resize operation is expanding the root filesystem. Use the pct resize command to add space:
# Add 10GB to the root disk of container 200
pct resize 200 rootfs +10G
# Verify the new size
pct config 200 | grep rootfs
# rootfs: local-lvm:vm-200-disk-0,size=30G
The beauty of LXC on Proxmox is that the filesystem inside the container expands automatically. There is no need to run resize2fs or xfs_growfs manually — Proxmox handles it. You can run this command while the container is running, and the extra space is available immediately.
Resizing CPU and Memory
CPU cores and memory can also be adjusted on a running container using pct set:
# Change CPU cores (online)
pct set 200 --cores 4
# Change memory limit (online)
pct set 200 --memory 4096
# Change swap (online)
pct set 200 --swap 2048
# Verify the changes
pct config 200
# cores: 4
# memory: 4096
# swap: 2048
These changes take effect immediately for running containers. The container does not need to be restarted. However, if you decrease memory on a container that is actively using more than the new limit, the kernel OOM killer may terminate processes inside the container. Always check current usage before reducing:
# Check current memory usage inside the container
pct exec 200 -- free -m
# total used free shared buff/cache available
# Mem: 2048 1450 120 15 478 420
# Or check from the host
pct status 200 --verbose | grep mem
Resizing Additional Mount Points
Containers can have additional mount points beyond rootfs (mp0, mp1, etc.). These are resized the same way:
# List all mount points
pct config 200 | grep -E "rootfs|mp[0-9]"
# rootfs: local-lvm:vm-200-disk-0,size=20G
# mp0: local-lvm:vm-200-disk-1,size=50G,mp=/data
# Resize mount point mp0
pct resize 200 mp0 +20G
# Verify
pct config 200 | grep mp0
# mp0: local-lvm:vm-200-disk-1,size=70G,mp=/data
Inside the container, check that the mount point reflects the new size:
pct exec 200 -- df -h /data
# Filesystem Size Used Avail Use% Mounted on
# /dev/sdb 70G 35G 32G 52% /data
Online Resize: What Works and What Does Not
Proxmox supports online (live) resizing for most operations:
- Disk expansion – Works online. The filesystem grows automatically.
- CPU cores – Works online. New cores are available immediately.
- Memory increase – Works online. The container can use the new limit right away.
- Memory decrease – Works online but can cause OOM kills if current usage exceeds the new limit.
- Disk shrink – Not supported. You cannot reduce disk size directly (see workaround below).
Shrinking a Disk: The Workaround
Proxmox does not support shrinking LXC disks because reducing a filesystem is risky and can cause data loss. If you absolutely need a smaller disk, use this manual workaround:
# 1. Create a backup of the container
vzdump 200 --mode stop --compress zstd --storage local
# 2. Note the backup file path
ls -la /var/lib/vz/dump/vzdump-lxc-200-*.tar.zst
# 3. Restore to a new container with a smaller disk
pct restore 201 /var/lib/vz/dump/vzdump-lxc-200-2026_04_18-01_00_00.tar.zst \
--storage local-lvm \
--rootfs local-lvm:15
# 4. Verify the new container works
pct start 201
pct exec 201 -- df -h /
# 5. Once confirmed working, remove the old container
pct stop 200
pct destroy 200
# 6. Optionally rename the new container's hostname
pct set 201 --hostname original-hostname
This approach creates a fresh container with the desired disk size and restores only the data from the backup. Make sure the new size is large enough to hold all existing data.
Bulk Resize with the API
If you need to resize multiple containers, scripting via the API is efficient:
#!/bin/bash
# Resize all containers in a list
CONTAINERS="200 201 202 203 204"
for CTID in $CONTAINERS; do
echo "Resizing container $CTID..."
pct resize $CTID rootfs +5G
pct set $CTID --memory 4096 --cores 2
echo "Container $CTID resized successfully"
done
For managing container resources on the go, ProxmoxR lets you view container resource usage and configuration from your mobile device, so you can spot containers that are running low on disk space before they cause issues.
Best Practices
- Always back up before resizing, especially when working with mount points or performing the shrink workaround.
- Monitor usage trends rather than reacting to emergencies. Set up alerts for containers approaching 80% disk usage.
- Use thin provisioning (LVM-thin or ZFS) so that allocated space is not consumed until the container actually writes data.
- Document your container specs so you can reproduce them quickly if needed.
Resizing LXC containers on Proxmox is one of the simplest administrative tasks you will perform. The key takeaway: expanding is easy and mostly online; shrinking requires a backup-and-restore workaround. Plan your initial sizes generously, and you will rarely need the workaround.
Take Proxmox management mobile
All the features discussed in this guide — accessible from your phone with ProxmoxR. Real-time monitoring, power control, firewall management, and more.