Managing Virtual Disks
In Virtuozzo Server, you can resize virtual disks and compact them (reduce their size on the physical hard drive). These operations are described in the following subsections in detail.
Resizing Virtual Disks
Before resizing a virtual disk, note the following requirements and restrictions:
- The virtual machine that uses the virtual disk to be resized must not have any snapshots.
- The virtual disk size shown inside the virtual machine or container may differ from the size the virtual disk occupies on server’s physical disk.
- In case disk size is increased, the added disk space is added as unallocated. You can use standard tools of the guest OS to allocate the added space.
- You cannot reduce a container’s virtual disk by more than 16TB in total if the container is running. To do this, stop the container first and run
vzctl set <CTID> --save --offline --diskspace <new_disk_size>. - You cannot reduce XFS file systems (the default choice for CentOS 7 and Red Hat Enterprise Linux 7).
Resizing Virtual Disks Offline
You can resize virtual hard disks of stopped virtual machines or containers with the prl_disk_tool resize --size command. For example:
| |
Resizing Virtual Disks Online
You can resize virtual hard disks of running containers with the prl_disk_tool resize --size command. For example:
| |
To resize virtual hard disks of running virtual machines, use the prlctl set --device-set --size --no-fs-resize command. For example, to resize the hdd0 hard disk of the MyVM virtual machine to 100G, execute:
| |
With the --no-fs-resize option specified, the last partition on the hard disk is not resized.
Checking the Minimum Disk Capacity
If, before reducing disk capacity, you want to know the minimum size to which it can be reduced, use the prl_disk_tool resize --info command. For example, if the disk hdd0 of the virtual machine MyVM is emulated by the image /vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/harddisk.hdd, run the following command:
| |
Compacting Disks
prl_disk_tool on disks of stopped virtual machines.In Virtuozzo Server, you can reduce the space your virtual machines and containers occupy on the physical server’s disk drive by compacting their virtual disks. Doing so frees up server disk space for hosting more virtual machines and containers.
To compact a virtual disk, you can use the prl_disk_tool compact command. For example, to compact the disk /vz/vmprivate/d35d28e5-11f7-4b3f-9065-8fef6178bc5b/harddisk.hdd, run this command:
| |
To check the space that was freed by compacting the virtual disk, you can use standard Linux utilities (for example, df).