4.10 How are Virtual Disks Managed?

Virtual machines need at least one disk from which to boot and run the operating system. Virtual disks can be part of a template or virtual appliance. Virtual disks can be created when you create the virtual machine or created independently inside the storage repository. Virtual disks can be shared across virtual machines, or dedicated to one virtual machine. All virtual disks available in the storage repository appear in Virtual Disks in the navigation tree when you select a storage repository, regardless of how they are created.

To create a virtual disk, see Create Virtual Disk in the Oracle VM Manager User's Guide. To import an virtual disk, see Import Virtual Disk in the Oracle VM Manager User's Guide. When you create a virtual machine from scratch, you are given the opportunity to either create a new virtual disk, or use an existing one. For more information about creating a virtual machine from scratch, see Create Virtual Machine in the Oracle VM Manager User's Guide.

When a virtual disk is created, using either the Oracle VM Manager Web Interface or the Oracle VM Manager Command Line Interface, the sectors on the virtual disk are automatically aligned to 4096 bytes or 4 KiB. This ensures the best possible compatibility with external tools such as those provided with Oracle VirtualBox and other third party vendors. If you attempt to create a virtual disk using the Oracle VM Web Services API and the disk is not aligned, an error is returned notifying you that you must size your disk appropriately. If a virtual disk is not either 512-byte aligned or 4-KiB aligned, some tools are unable to read or process the virtual disk and may return errors while attempting to do so. In this case, you must resize the virtual disk to be appropriately aligned. You can find out more on resizing virtual disks in Edit Virtual Disk in the Oracle VM Manager User's Guide.

Note

Oracle supports the provisioning of a virtual machine with Oracle Cluster File System version 2 (OCFS2) on a virtual disk image, regardless of the underlying shared file system. That is to say, Oracle supports OCFS2 on virtual machines in an Oracle VM environment even if the underlying repository is NFS based. However, the subnet that is used for the private interconnect inside the virtual machine must not conflict with the subnet used on dom0.

While virtual disks may prove easy to manage and migrate, there is a performance cost associated, since file systems are nested within each other. It is possible to create a virtual machine that does not use a virtual disk, but uses virtual storage from a raw physical disk in the form of a LUN accessed directly by the virtual machine. Therefore, for virtual machine disks Oracle VM provides two options:

  • Virtual disks: Disk image files on a file system, usually reside in a storage repository.

  • Raw physical disks: LUNs accessed directly by the virtual machine.

The design decision of virtual versus physical storage access depends on your server virtualization use cases as well as the existing storage hardware at your disposal. Virtual storage enables quick and easy on-the-fly configuration, but introduces a higher level of abstraction, since multiple file systems are nested within each other. Therefore, when using virtual storage it is important to balance ease of use against the lower performance compared to physical storage. Physical storage access implies that virtual machine disk storage is mapped directly onto the LUNs configured in the physical storage hardware, which is exactly like the way physical servers access their storage. The advantage here is that existing procedures and storage management practices can be maintained.

Virtual disks can be detected as different device types within a virtual machine. Older templates and virtual machines tend to detect these disks as hdx devices, while newer virtual machines and templates detect virtual disks as xvdx devices. Oracle VM does not support virtual machines that use mixed device types for virtual disks. If you are working with an older template or virtual machine, it is recommended that you remove all current disk mappings and then recreate them so that they use the new xvdx device types. Alternately, if your virtual machine does not support xvdx device types at all, you should edit the vm.cfg file for the virtual machine by hand to make sure that any storage devices, such as a virtual cdrom device, are changed from xvdx devices to hdx devices. For instance, you might change the following entry in the vm.cfg file:

disk = [
file:/OVS/Repositories/0004fb00000300000eaa1a4a8e297e7c/VirtualDisks\ 
        /0004fb0000120000ce3f55b28a87d068.img,xvda,w,
file:/OVS/Repositories/0004fb00000300000eaa1a4a8e297e7c/ISOs\
       /0004fb000015000040ba0ea64887c0d0.iso,xvdb:cdrom,r]

to:

disk = [
file:/OVS/Repositories/0004fb00000300000eaa1a4a8e297e7c/VirtualDisks\
        /0004fb0000120000ce3f55b28a87d068.img,hda,w,
file:/OVS/Repositories/0004fb00000300000eaa1a4a8e297e7c/ISOs\
       /0004fb000015000040ba0ea64887c0d0.iso,hdb:cdrom,r]

Disk space allocation for virtual disks is either sparse or non-sparse. Non-sparse allocation means that all the configured space is allocated from the beginning, whereas sparse allocation means that the virtual disk initially takes up little space on the underlying storage, but grows as it is used and more content is added. When sparse virtual disk space allocation is used, the available space in a repository can be over-subscribed. Sparse allocation is useful to increase virtual machine density. However, errors occur if the space allocated to a storage repository becomes exhausted, so the administrator must carefully monitor disk space and make sure that the storage repository maintains sufficient disk space to accommodate the provisioned virtual disks. The same principle applies to a SAN where thin provisioning is used.

Virtual disks can be added or removed from a virtual machine at any point, however if a virtual machine is suspended, you cannot add or remove any virtual disks until the virtual machine is either running or stopped. For more information on updating the virtual disks assigned to a virtual machine, refer to Edit Virtual Machine in the Oracle VM Manager User's Guide.