Today I am shrinking my container volumes so that I can back them up and reinstall Proxmox.

The machine I am working on is a HPE DL360 Gen 7 it currently has two Intel Xeon X5660’s, and yes i know they are vulnerable, but if you’re firewalled it should be fine, unless someone breaks in to my house! I will list my specifications in a separate post, as this is not the only server / PC I have.

This is my Docker Container, yes a container named Docker for my docker containers….

Screenshot of my Docker Container Virtual Machine

As you can see, it has 32GB of space, these containers do not need that much room, ass the only containers running are Omada Cloud, Portainer, Heimdall and Open Speed Test. these currently do not need that much room, it also does not need 8GB RAM or 2 CPU’s so I will be reducing these too.

Running the command du -sh will give us how much space has been used  which in this container it is 5.5GB, this means that 10GB will be enough, if we need more later we can expand it.

First we need to stop the container from running, then we can edit the config file that is found in the /etc/pve/ directory on the Proxmox machine, we need to make sure that the container has been stopped before editing the config file, using the command qm stop 104 where 104 is the container number, once stopped we can edit the container config file..

We need to find the line sata0: local:104/vm-104-disk-0.qcow2,size=32G and change the 32G to 10G, then save the config, once we have done that we can backup the container via the Proxmox web interface, Backup of container 10

Backup of container 104

once this has backed up, I can see that the total size for the backup is 8.9GB so I was not far off on my estimate of 10GB. Now I can then delete the container and restore it from disk, this all can be done from the Web interface (but not the edit of the config file).

Restore from Backup

Restoring from backup is the slowest part, as it is rebuilding the volume and container from a compressed state. Once this is done, we can start the container and I should get a notification from Uptime-Kuma saying that the Docker containers are running again.

If you enjoyed this then checkout my other posts!

Chris.

Categories:

Comments are closed