Free Up Space On Virtuozzo Hosts
When using Virtuozzo and Ploop containers sometimes there can be issues with space management. It’s possible that you can delete a file inside a container and the container’s space usage is decreased but then that decrease in space is not reflected on the host node.
Symptom
For example, your hostnode has a 1TB hard drive and the full 1TB is being used. You have a container on this hostnode that is 50GB in size and the full 50GB is being used. You delete a .tar.gz file inside this container which is 10GB and the space on the container is now showing as using 40GB. When you check the hostnodes disk usage this 10GB is not showing.
Resolution
You have the ability to compress containers hard drives to free up space Virtuozzo. You achieve this by removing all the empty blocks from the expanding virtual disk to reduce its size.
Log in as the root user to the hostnode and create a /bin/compress file
yum install nano -y ; nano /bin/compress
Inside this file place the following code;
!/bin/sh
vzlist -a | awk '{print $1}' | sed '/CTID/d' > ctid.txt
echo "Compact started on $(date)" >> compactlogs.txt
for i in cat ctid.txt
do
prl_disk_tool compact --hdd /vz/private/$i/root.hdd;
done
echo "Compact finished on $(date)" >> compactlogs.txt
Save and close the file and chmod it to 700
chmod 700 /bin/compress
Finally, run the file and your containers will be compressed. It’s totally safe to run and will not delete any information.
/bin/compress
It could take up to 24 hours to run on a SATA based hostnode. A log file will be placed called compactlogs.txt which will tell you the time the compression started and ended.
After the process is complete check the space usage on your hostnode with the df -h command to see your newly gained space.
You might also like
More from SolusVM
How to automatically setup additional IPs In your KVM VPS
If you reinstall your VPS server and your using a KVM solution plus you have additional IPs attached to your …
How to update your VPS Server root password
How to update your VPS Server root password If you want to update the root/admin password of your VPS server we …