VMware

VMware ACE

Features | Documentation | Knowledge Base | Discussion Forums

previous Prev   Contents   Last   Next next

Configuring Hard Disk Storage in a Virtual Machine

Configuring Hard Disk Storage in a Virtual Machine

Like a physical computer, a VMware ACE virtual machine stores its operating system, programs and data files on one or more hard disks.

The New Virtual Machine Wizard creates a virtual machine with one disk drive. You can use the virtual machine settings editor (VM > Settings) to add more disk drives to your virtual machine, to remove disk drives from your virtual machine or to change certain settings for the existing disk drives.

This section describes the choices you can make in setting up hard disk storage for your virtual machine.

Virtual Disk Basics

Virtual Disk Basics

In the most common configurations, VMware ACE creates virtual hard disks, which are made up of files that are typically stored on your host computer's hard disk.

A virtual disk is a file or set of files that appears as a physical disk drive to a guest operating system. While you are working in VMware ACE Manager, the files can be on the host machine or on a remote computer. When an end user installs a package, the virtual disk files are always stored locally.

When you configure a virtual machine with a virtual disk, you can install a new operating system onto the virtual disk without repartitioning a physical disk or rebooting the host.

IDE virtual disks can be as large as 128GB. SCSI virtual disks can be as large as 256GB. Depending on the size of the virtual disk and the host operating system, VMware ACE creates one or more files to hold each virtual disk.

By default, the actual files used by the virtual disk start out small and grow to their maximum size as needed. The main advantage of this approach is the smaller file size. Smaller files require less storage space and result in a more compact package for distribution to your end users. They also are easier to move if you want to move the virtual machine to a new location. However, it takes longer to write data to a disk configured in this way.

Virtual disks can be set up as IDE disks for any guest operating system. They can be set up as SCSI disks for any guest operating system that has a driver for the LSI Logic or BusLogic SCSI adapter available in a VMware ACE virtual machine. You determine which SCSI adapter to use at the time you create the virtual machine.

Note: To use SCSI disks in a Windows XP or Windows Server 2003 virtual machine, you need a special SCSI driver available from the download section of the VMware Web site at www.vmware.com/download. Follow the instructions on the Web site to use the driver with a fresh installation of Windows XP or Server 2003.

A virtual disk of either type can be stored on either type of physical hard disk. That is, the files that make up an IDE virtual disk can be stored on either an IDE hard disk or a SCSI hard disk. So can the files that make up a SCSI virtual disk. They can also be stored on other types of fast-access storage media, such as DVD-ROM or CD-ROM discs.

File Locations

File Locations

Disk Files

Disk Files

The virtual machine settings editor (VM > Settings) allows you to choose the disk files for a virtual machine.

You may want to choose a file other than the one created by the New Virtual Machine Wizard if you are using a virtual disk that you created in a different location or if you are moving the automatically created disk files to a new location.

The disk files for a virtual disk store the information that you write to a virtual machine's hard disk — the operating system, the program files and the data files. The virtual disk files have a .vmdk extension.

A virtual disk is made up of one or more .vmdk files.

On Windows hosts, each virtual disk is contained in one file by default. You may, as an option, configure the virtual disk to use a set of files limited to 2GB per file. Use this option if you or your end users may place the virtual disk on a file system that does not support files larger than 2GB. This is also the preferred option for virtual machines that may be installed on a FAT32 file system.

You must set this option at the time the virtual disk is created.

If you are setting up a new virtual machine, in the New Virtual Machine Wizard follow the Custom path. In the panel that allows you to specify the virtual disk's capacity, select Split disk into 2GB files.

If you are adding a virtual disk to an existing virtual machine, follow the steps in the Add Hardware Wizard. In the panel that allows you to specify the virtual disk's capacity, select Split disk into 2GB files.

When a disk is split into multiple files, larger virtual disks have more .vmdk files.

The first .vmdk file for each disk is small and contains pointers to the other files that make up the virtual disk. The other .vmdk files contain data stored by your virtual machine and use a small amount of space for virtual machine overhead.

If you chose to allocate space for the virtual disk in advance, the file sizes are fixed, and most of the files are 2GB. As mentioned above, the first file is small. The last file in the series may also be smaller than 2GB.

If you did not allocate the space in advance, the .vmdk files grow as data is added, to a maximum of 2GB each — except for the first file in the set, which remains small.

The virtual machine settings editor shows the name of the first file in the set — the one that contains pointers to the other files in the set. The other files used for that disk are automatically given names based on the first file's name.

For example, a Windows XP Professional virtual machine using the default configuration, with files that grow as needed, stores the disk in files named Windows XP Professional.vmdk, Windows XP Professional-s001.vmdk, Windows XP Professional-s002.vmdk and so on.

Lock Files

Lock Files

A running virtual machine creates lock files to prevent consistency problems on virtual disks. If the virtual machine did not use locks, multiple virtual machines might read and write to the disk, causing data corruption.

Lock files are always created in the same directory as the .vmdk file.

The locking methods used by VMware software on Windows and Linux hosts are different, so files shared between programs running on the two platforms are not fully protected. If you use a common file repository that provides files to users of VMware products on both Windows and Linux hosts, be sure that each virtual machine is run by only one user at a time.

When a virtual machine is powered off, it removes the lock files it created. If it cannot remove the lock, a stale lock file is left protecting the .vmdk file. For example, if the host machine crashes before the virtual machine has a chance to remove its lock file, a stale lock remains.

If a stale lock file remains when the virtual machine is started again, the virtual machine tries to remove the stale lock. To make sure that no virtual machine could be using the lock file, the virtual machine checks the lock file to see if

  1. The lock was created on the same host where the virtual machine is running.
  2. The process that created the lock is not running.

If those two conditions are true, the virtual machine can safely remove the stale lock. If either of those conditions is not true, a dialog box appears, warning you that the virtual machine cannot be powered on. If you are sure it is safe to do so, you may delete the lock files manually. When created by VMware products on Windows hosts, the filenames of the lock files end in .lck.

Defragmenting and Shrinking Virtual Disks

Defragmenting and Shrinking Virtual Disks

If you have a virtual disk that grows as data is added, you can defragment and shrink it as described in this section.

To defragment the virtual disks attached to a virtual machine, power off the virtual machine, then go to the virtual machine settings editor (VM > Settings).

Select the virtual disk you want to defragment, then click Defragment.

Defragmenting disks may take considerable time.

Note: The defragmentation process requires free working space on the host computer's disk. If your virtual disk is contained in a single file, for example, you need free space equal to the size of the virtual disk file. Other virtual disk configurations require less free space.

When a virtual machine is powered on, you can shrink its virtual disks from the VMware Tools control panel. You cannot shrink virtual disks if a snapshot exists. To remove the snapshot if one exists, choose Snapshot > Remove Snapshot.

  1. To launch the control panel in a Windows guest, double-click the VMware Tools icon in the system tray or choose Start > Settings > Control Panel, then double-click VMware Tools.

    To launch the control panel in a Linux or FreeBSD guest, become root (su -), then run vmware-toolbox.

  2. Click the Shrink tab.
  3. Select the virtual disks you want to shrink, then click Prepare to Shrink.

The shrink tool reclaims unused space in the virtual disk. If there is empty space in the disk, this process reduces the amount of space the virtual disk occupies on the host drive.

Shrinking disks may take considerable time.

In some configurations, it is not possible to shrink virtual disks. If your virtual machine uses such a configuration, the Shrink tab displays information explaining why you cannot shrink your virtual disks.

For best disk performance, you can take the following three actions, in the order listed:

  1. Run a disk defragmentation utility inside the virtual machine.
  2. Use the VMware ACE defragmentation tool. Go to VM > Settings, click the listing for the virtual disk you want to defragment, then click Defragment.
  3. Run a disk defragmentation utility on the host computer.

previous Prev   Contents   Last   Next next