How to reclaim or compact space in ploop containers

Category : Linux/ Unix

One of the major drawback in using ploop filesystem in the virtualisation (Virtuozzo) is that the containers use more than actual use space. This keeps on increasing with time too.

The space used by the container on the node disk is way more then actual data size inside container used.

To reclaim the space, you would need to manually truncate the unused blocks of a container with the help of prl_disk_tool utility.

Following command will truncate the unused block :

prl_disk_tool compact --hdd /vz/private/101/root.hdd/

You would need to replace 101 by the CTID of the container. You may schedule this is a cron so from time to time your host node space is reclaimed.

You can find CTID of container by running the command :

vzlist -a

If you are unable to get / reclaim much of the space due to the data structure used inside the container then you can stop the container, downsize the container to it’s actual disk usage size and after doing that, again revert to original size. This will free up the needed space too.

For more useful vzctl commands , you can refer : https://www.basezap.com/openvz-useful-commands/