Managing VMware Server 2.0 Virtual Disks

Revision as of 15:14, 22 October 2008 by Neil (Talk | contribs)

Revision as of 15:14, 22 October 2008 by Neil (Talk | contribs)

Rather than using a physical disk drive to store the system and user files for a guest operating system, VMware Server virtual machines use files (known as virtual disks) located on the disk drives attached to the host system.

The objective of this chapter is to provide an overview of the creation, management and configuration of virtual disks.

VMware Server Virtual Disk and Device Types

Virtual disks provide the storage for guest operating system and user files. Each VMware Server virtual machine will likely have one or more virtual disks configured and during the lifecycle of a virtual machine virtual disks may be added and removed as needed. the size of a virtual disk is specified at creation time and can range from 1MB up to a maximum of 950GB).

When a virtual disk is first created (either during the virtual machine process or later) it may be configured as growable or pre-allocated. Once this decision has been made about a virtual disk, it is not possible to change this configuration option. A growable disk is initially created smaller than the specified disk size, and subsequently grows as space is needed up until the maximum specified size is reached. This has the advantage that the disk creation process is shorter and less disk space on the host is used initially. A further advantage of growable disks is that the size of the disk can be reduced at a later time using the VMware Tools Shrink Disk feature (see the chapter entitled The VMware Tools Control Panel for more details on this and other VMware Tools features). These features, however, come at the cost of reduced performance (since system resources will be needed to increase the size of the disk as additional data is written).

In the case of a pre-allocated virtual disk, the entire space required for the disk is allocated at creation time. This has the advantage that virtual disk performance is not degraded due to the need to increase the disk size as more space is needed. Disadvantages include an increased amount of time needed to create the disk (taking several hours for a 950GB virtual disk) and the inability to reduce the size of the disk at a later time.

An additional options allows virtual disks to be split amongst multiple 2GB files on the host, rather than contained in a single file. This option has little benefit unless VMware Server is hosted on a file system which limits file sizes to 2GB.

To the guest operating system running inside a virtual machine, virtual disks appear as though they are physical devices. As such, the disk can be configured to appear to the virtual machine as either an IDE or SCSI device. In the case of SCSI virtual disks, VMware uses a virtual SCSI controller which appears to the guest as either an LSI Logic or BusLogic controller. As such, guest operating system drivers may need to be installed accordingly.


VMware Server Disk Modes

VMware Server virtual disks may be configured to run either in Independent mode which provides two additional options in terms of disk configuration:

  • Persistent - Data written to the disk by the guest operating system is retained when the system is powered off. This is the normal mode of operating for most virtual disks.
  • Nonpersistent - Data written to the disk during a virtual machine session are discarded after the virtual machine is powered off or reset. This is useful if the guest operating system is required to be started with a clean system each time the virtual machine is powered on, perhaps in a testing or secure environment.

Disks configured as independent are not included in snapshots.

VMware Server Virtual Disk Caching Options

The disk write caching policy for virtual disks defines the point at which new data is written to the virtual disk (as opposed to being cached in memory before being written) by the guest operating system. These settings have implications for performance, with increased performance being available at the cost of data integrity. A choice of two policy options are available:

  • Optimize for safety - Data is not cached. Write operations made by the guest operating system are written immediately to the virtual disk image. Reduces risk of data loss in the event of a system failure, but results in slower disk write performance.
  • Optimize for performance - Write operations performed by the guest operating system are initially cached prior to being written to the virtual disk. Provides increased write performance at the cost of increased risk of data loss on system failure.

Adding a New Virtual Disk

A new virtual disk may be added to a virtual machine via the VI Web Access management interface (details of which are covered in the A Guided Tour of the VMware Server 2.0 Infrastructure Web Access Interface chapter of this book). SCSI based virtual disks may be installed on running virtual machines as long as those machines are running on VMware virtual hardware version 7 or later (the default setting when virtual machines are created in VMware Server 2.0). IDE based virtual disks or virtual machines running on older versions of the virtual hardware require that the virtual machine be powered off prior to addition of a new virtual disk.

Once logged into the VI Web Access interface, the first step in adding a new virtual disk is to select the required virtual machine from the Inventory panel. In the Commands section of the virtual machine workspace, click on the Add Hardware link to invoke the Add Hardware Wizard as illustrated in the following figure:


The VMware Server Add Hardware Wizard


To add a new virtual disk, select the Hard Disk option from the list of new hardware devices to proceed to the Hard Disk page. Options are available to either create an entirely new virtual disk, or to use an existing virtual disk that may already have been created for a pre-existing virtual machine. In fact, this second option can be used to enable multiple virtual machines to share a virtual disk, although careful steps should be taken to avoid disk write conflicts (for example both guests attempting to write simultaneously to the same disk block will likely cause problems for most standard file systems).

Once a decision has been made about creating or re-using a virtual disk, the next wizard screen provides the option to configure the disk type, mode and caching options as described in the preceding sections of this chapter. Finally, a summary page is displayed highlighting the choices made during the configuration process. Clicking the Finish button will begin the addition process which, depending on the settings, may take some time to complete.

Modifying a VMware Server Virtual Disk Configuration

The current configuration of a virtual disk may be viewed and modified by logging into the VI Web Access interface and selecting the virtual machine to which the disk is attached from the Inventory panel. Once the workspace updates to reflect the selected virtual machine, locate the disk drive from the Hardware panel, click on it and select Edit... from the menu. This will display the hard disk settings dialog as illustrated in the following figure:


Editing the settings for a VMware Server virtual disk


An important point to note is that many of the settings will be read-only (and consequently grayed out) if the selected, or any other virtual machine which shares the disk, virtual machine is currently powered on. In addition, the Increase capacity... link shown in the above figure will not be visible if the virtual machine. To make changes to configuration values, or to increase disk capacity, it will be necessary to power off all virtual machines that utilize the virtual disk.

Enlarging a VMware Server Virtual Disk

The capacity of a virtual disk may be increased using the disk settings dialog (described above). As with most other virtual disk settings, a disk may only be increased in size when all virtual machines sharing disk are powered off. Once this is achieved, select a virtual machine which uses the virtual disk from the Inventory panel of the VI Web Access interface, click on the required hard disk from the Hardware panel and select Edit... from the menu. Once the disk settings dialog appears, click on the Increase capacity... link to display the disk capacity fields as illustrated in the following figure:


Increasing the size of a VMware Server 2.0 virtual disk


The current size of the virtual disk is listed, together with two text boxes for the amount by which the disk is to be increased and the new capacity. Both are specified in GB, and either may be used to increase the size of the virtual disk. The amount of space available for allocation to the virtual disk is dictated by the available space on the datastore in which the virtual disk file resides. The current free space on the datastore also listed beneath the capacity text boxes. The increase in virtual disk capacity cannot exceed this value.


Shrinking a VMware Server Virtual Disk

Removing a VMware Server Virtual Disk