ovz
In a situation when a lot of disk space were freed on an in-ploop filesystem, use ploop balloon discard to optimize the ploop image size.
ploop balloon discard | [–automount] [–to-free size] [–min-block min_size] [–defrag] DiskDescriptor.xml |
Iteratively try to relocate and discard unused blocks from a ploop image, reducing its size.
Note that ploop device and its inner file system should be mounted. If not, one can use –automount option to automatically mount ploop for the duration of the operation.
Option –defrag can be used to run a filesystem defragmentation utility (currently e4defrag2 on ext4 only) before the main operation.
Option –to-free can be used to specify a maximum disk space to be freed. In other words, stop the process once freed space exceeded requested size. Default is 0, meaning to try to free as much space as possible.
Option –min-block can be used to specify a minimum size of an extent to free. The smallest possible extent is 1 cluster (currently 1 MB), one can specify higher value to speed up the whole discarding operation.
Note that the same functionality is available by means of vzctl compact command.