LXC

I was recently trying to resize a lxc container from my proxmox server (I’m running the latest proxmox version). Even though I have increased the disk space assigned to that container, for some reason I was not able to actually see the new size of the disk inside the container. I must say that the disks are configured as LVM on the Proxmox server.

After several unsuccessfull attempts, considering that the container size was not that big (initially the size was 10G and I needed to increase the space up to 25G) I have taken a different approach: re-creating the container (from a dump) with a larger disk.

The necessary steps are as follows:

1) Stop the container (you can do it from the proxmox web interface but considering that you will need ssh access to the server the complete the other steps, I have stopped the container using a simple command issued on the linux shell prompt):

2) Create a full container backup (to preserve the actual information within the container):

3) Destroy the container

4) Restore the container from the previous created backup

Some infos about step 4:
The default backup location is /var/lib/vz/dump
When you create a backup using vzdump the file structure for the backup is: vzdump-lxc-container-idyear_month_dayhour_minutes_seconds.tar.lzo
local-lvm represents the name (description) of the local storage volume as shown in the proxmox web interface (Storage View); depending of your configuration, the name is probably different

That would be all. I now have the exact same container but with bigger disk size (instead of the initial 10G now it’s 25G).

Probably there are other ways to increase the available space inside an LXC container but since my time was limited, this looked like the easiest and fastest approach. Of course, this is a good approach especially when the lxc container disk sizes are not that big (let’s say under 100G). For bigger containers, the time necessary for the vzdump could be quite big (it directly depends of your server configuration, hard disks speed/type etc).

Share.

About Author

I am a linux passionate and currently working as a Linux Senior System Administrator. I also am a freelancer and help people to complete different jobs. You can hire me on Freelancer.com

Leave A Reply

Get new posts by email: