Virtual Disks on Xen and KVM
Cloudmin currently only supports management of virtual disk images for Xen and KVM systems, as other virtualization types use a directory on the host filesystem to store files instead of images.
Each Xen system has one or more files or devices on the host system (like /xen/mysystem.img</code)> mapped to devices on the virtual system (like <code>/dev/sda1). The disks on the host can be regular files, LVM logical volumes, or actual disk partitions. In the virtual system, these are typically mapped to partitions, but can be an entire disk.
When Cloudmin creates a new Xen system, it will also build at least one virtual disk whose contents are a copy of the selected system image. If you select to enable swap as well, another disk will be created for the swap file. These will be mapped to /dev/sda1 and /dev/sda2 on the virtual system respectively.
For KVM, files or devices on the host system (like /kvm/mysystem.img) are mapped to entire disks on the virtual system (like /dev/hda). This disk image then contains one or more partitions, which can be mounted as filesystems on the virtual machine, or used for LVM or RAID.
When Cloudmin creates a new KVM syste, it will create a disk image typically with a single partition. This is then mounted as the root filesystem on the virtual machine. In some cases, there may be an additional partition that is used for the /boot filesystem.
Expanding a Virtual Disk
The most common operation to perform on a disk image is expanding it when the filesystem is full. The steps to do this are :
- Login to Cloudmin, and select the system from the left menu.
- If the system is running, shut it down. A virtual system's filesystem cannot be modified while it is running.
- Go to Resources -> Manage Disks .
- Click on the appropriate disk, which is typically mapped to SCSI device A partition 1 for the root filesystem.
- Increase the Disk file size , then click Save.
- After the resize is complete, start the system up again.
This process is identical for disk images stored in regular files or logical volumes. In both cases, the size increase will fail if the underlying host filesystem or volume group does not have enough free space.
This same procedure can be used to shrink a disk, assuming that the filesystem on is not using more space than the new disk size.
For KVM whole-disk images, expansion of a disk is only possible if there is a single partition or if the final partition contains the filesystem being expanded.
Creating a Virtual Disk
You might want to add a disk to a system for use as virtual memory, or to move some files onto. The steps to do this are :
- Login to Cloudmin, and select the system from the left menu. It does not have to be shut down.
- Go to Resources -> Manage Disks , and click on Create a new virtual disk.
- In general, the disk file and device fields will be automatically filled in with reasonable defaults. All you need to enter is the New disk file size.
- To have Cloudmin create a filesystem on the disk, select it from the Filesystem to create menu. You can also choose to mount it somewhere on the virtual system by entering a path in the Mount new disk as field.
- Click the Create button.
A reboot of the virtual system will be needed before the new disk is available.
Deleting Virtual Disks
If a virtual system no longer needs a disk, you can remove it as follows. All data on the disk will be lost though! Removal of the disk for the system's root filesystem is not possible.
- Login to Cloudmin, and select the system from the left menu.
- If the system is running, either shut it down or kill any processes on the system using the disk.
- Go to Resources -> Manage Disks , and click on the disk.
- Click the Delete button.
OpenVZ Disk Limits
OpenVZ virtual systems can limit disk usage in a different way - instead of using fixed-size virtual disks, each system can have an optional limit on the amount of disk space its filesystem can consume. This can be set on the Create New System page in the Resource limit options section, or modified later on the Resource Limits page.
Virtual Disks and System Owners
Account plans can be used to define a total disk limit for system owners, which applies to the sum of all disks on all systems belonging to the owner. For example, if an owner has a limit of 10GB of disk he could create a virtual system with two 3GB disks, and other with 1 2GB disk.
For OpenVZ systems, the disk space limit is counted towards the owner's total disk space. If an owner has a disk limit, he will not be allowed to create an OpenVZ system without a limit.
