OpenVZ provides a possibility to reduce the size of an expanding virtual disk by setting the limit the disk cannot exceed. To do this, use the prl_disk_tool resize --size
command. For example:
# prl_disk_tool resize --hdd /vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/ \
harddisk.hdd --size 30G
When reducing the disk capacity, keep in mind the following:
- You can only reduce the capacity of virtual disks of stopped virtual machines.
- The virtual machine using the virtual disk you want to configure must not have any snapshots. In this case, you should delete all existing snapshots and run the command again. To learn how to delete snapshots of a virtual machine, refer to Section 2.11.4, “Deleting Snapshots”.
- The capacity of an expanding virtual disk shown from inside the virtual machine or container and the size the virtual disk occupies on the server’s physical disk may differ.
- You cannot reduce XFS filesystems (the default choice for CentOS 7 and Red Hat Enterprise Linux 7).