Symptoms
Ploop container consumes significantly more disk space on the server, than the data size inside it:
[root@vz ~]# du -h /vz/private/101/root.hdd/root.hds
154G /vz/private/101/root.hdd/root.hds
[root@vz ~]# vzctl enter 101
entered into Container 101
CT-101-bash-4.1# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/ploop18346p1 197G 62G 133G 32% /
none 1.0G 4.0K 1.0G 1% /dev
Cause
Depending on the data structure inside a container, a scheduled daily job that compacts ploop images automatically, /etc/cron.d/pcompact
, might not be effective. One of the possible reasons of such behavior is high fragmentation level inside a container.
Resolution
Optimizations of pcompact
are planned in future Virtuozzo updates in scope of request with internal ID #PSBM-30164.
For now, there are few methods to compact a container manually.
Truncate unused blocks with the help of
prl_disk_tool
utility:[root@vz ~]# prl_disk_tool compact --hdd /vz/private/101/root.hdd/
Downsize stopped container and upsize it back to the original value:
[root@vz ~]# vzctl stop 101 [root@vz ~]# prl_disk_tool resize --hdd /vz/private/101/root.hdd --size 75000M [root@vz ~]# prl_disk_tool resize --hdd /vz/private/101/root.hdd --size 199000M
Internal content
Another undocumented solution:
[root@vz ~]# vzctl stop 101
[root@vz ~]# vzctl set 101 --diskspace 200G --save --offline
NOTE: At least the same amount of space consumed by the container should be free on the node to perform offline resize operation.