Contents

Configuring Hard Disk Storage in a Virtual Machine

Like a physical computer, a VMware Workstation virtual machine stores its operating system, programs and data files on one or more hard disks. Unlike a physical computer, VMware Workstation gives you options for undoing changes to the virtual machine's hard disk.

The New Virtual Machine Wizard creates a virtual machine with one disk drive. You can use the Virtual Machine Control Panel (Edit > Virtual Machine 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.

Disk Types: Virtual and Raw

In the most common configurations, VMware Workstation creates virtual hard disks, which are made up of files that are typically stored on your host computer's hard disk. In some circumstances, you may need to give your virtual machine direct access to a physical hard drive on your host computer - using the disk type also referred to as a raw disk.

Virtual Disk

A virtual disk is a file or set of files that appears as a physical disk drive to a guest operating system. The files can be on the host machine or on a remote computer. 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 Workstation 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 are easier to move if you want to migrate the virtual machine to a new location.

You may also configure virtual disks so all the disk space is allocated at the time the virtual disk is created. This approach provides enhanced performance and is needed if you are setting up clustering under Microsoft Clustering Services. Flat virtual disks are similar to the experimental plain disks that could be created under VMware Workstation 2.

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 BusLogic SCSI adapter used in a VMware Workstation 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.

A key advantage of virtual disks is their portability. Because the virtual disks are stored as files on the host machine or a remote computer, you can move them easily to a new location on the same computer or to a different computer. You can also use VMware Workstation on a Windows host to create virtual disks, then move them to a Linux computer and use them under VMware Workstation for Linux - or vice versa. For information about moving virtual disks, see Moving and Sharing Virtual Machines.

Raw Disk

A raw disk directly accesses an existing local disk or partition. You can use raw disks if you want VMware Workstation to run one or more guest operating systems from existing disk partitions. Raw disks may be set up on both IDE and SCSI devices. At this time, however, booting from an operating system already set up on an existing SCSI disk or partition is not supported.

The most common use of a raw disk is for converting a dual-boot or multiple-boot machine so one or more of the existing operating systems can be run inside a virtual machine.

Caution: If you run an operating system natively on the host computer, then switch to running it inside a virtual machine, the change is like pulling the hard drive out of one computer and installing it in a second computer with a different motherboard and other hardware. You need to prepare carefully for such a switch. The specific steps you need to take depend on the operating system you want to use inside the virtual machine. For details, see Configuring a Dual-Boot Computer for Use with a Virtual Machine.

You can also create a new virtual machine using a raw disk. For details, see Installing an Operating System onto a Raw Partition from a Virtual Machine. In most cases, however, it is better to use a virtual disk.

Only expert users should attempt raw disk configurations.

Note: You should not use a raw disk to share files between host and guest operating systems. It is not safe to make the same partition visible to both host and guest. You can cause data corruption if you do this. To share files between host and guest operating systems, use shared folders. For details, see Using Shared Folders.

File Locations

Disk Files

The Virtual Machine Control Panel (Edit > Virtual Machine 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 comprises 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 plan to move the virtual disk to a file system that does not support files larger than 2GB.

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 screen that allows you to specify the virtual disk file, click Advanced and select Split disk into 2GB chunks.

If you are adding a virtual disk to an existing virtual machine, follow the steps in the Add Hardware Wizard. In the screen that allows you to specify the virtual disk file, click Advanced and select Split disk into 2GB chunks.

When a disk is split into multiple files, larger virtual disks have more .vmdk files. As data is added to a virtual disk, the .vmdk files grow in size, to a maximum of 2GB each. Almost all of a .vmdk file's content is the virtual machine's data, with a small portion allotted to virtual machine overhead.

If the virtual disk needs 2GB or more disk space, the Virtual Machine Control Panel shows the name of the first file in the set of files used to store the virtual disk. 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 that needed two files to store its virtual disk would, by default, store the disk in files named Windows XP Professional.vmdk and Windows XP Professional-02.vmdk.

If your virtual machine uses files created under earlier VMware products, with a .dsk extension, the filenames can be updated automatically on a Windows host. For details, see Updating Filenames for Virtual Disks Created with Earlier VMware Products.

If you are using a raw disk, the .vmdk file stores information about the physical disk or partition used by the virtual machine.

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 users to lose data.

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

The locking methods used by VMware Workstation on Windows and Linux hosts are different, so files shared between them are not fully protected. If you use a common file repository that provides files to users 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 machine crashes before the virtual machine has a chance to remove its lock file, there is a stale lock.

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 explaining what you can do about the lock.

Raw disk partitions are also protected by locks. However, the host operating system is not aware of this locking convention and thus does not respect it. For this reason, VMware strongly recommends that the raw disk for a virtual machine not be installed on the same physical disk as the host operating system.

Updating Filenames for Virtual Disks Created with Earlier VMware Products

Except for VMware Workstation 3, previous VMware products, including VMware Workstation 2, named virtual disk files with a .dsk extension. To avoid conflicts with the System Restore feature on Windows XP and Windows Server 2003 hosts, VMware Workstation now uses a .vmdk extension for those files. VMware Workstation 4 updates existing virtual disk files automatically. It also automatically updates references to the virtual disk files in the configuration files for the virtual machine.

In addition, VMware Workstation converts the filename extensions for the files that store the state of a suspended virtual machine. The old extension was .std. The extension is now .vmss.

If your host computer is running Windows XP or Windows Server 2003, VMware Workstation must turn off System Restore on the host computer while it runs the updater. If this were not done and you restored the host to a time before you ran the updater, the System Restore feature would rename your virtual disk files to use the.dsk extension. You would again have the conflict the updater was designed to solve.

Note: Because the VMware Workstation updater turns off the System Restore feature while it runs, all existing restore points are deleted.

System Restore is turned back on after the updater completes its work.

Running the Updater at a Later Time

On a Windows host computer, you can run the filename updater at any time. To do so, follow these steps.

  1. Open a command prompt.
  2. Change to the folder in which the VMware Workstation program files are installed. If you installed the files in the default locations, use this command:

    cd C:\Program Files\VMware\VMware Workstation\Programs

  3. Run the updater.

    dskrename.exe

Defragmenting and Shrinking Virtual Disks

When a virtual machine is powered off, you can defragment its virtual disks from the Virtual Machine Control Panel (Edit > Virtual Machine 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. You should have free space equal to about 80 percent of the size of the virtual disk file or files.

When a virtual machine is powered on, you can shrink its virtual disks from the VMware Tools control panel.

  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.

Note: VMware recommends you defragment your host computer's hard drive after 10 shrink operations on a virtual disk.

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 Workstation defragmentation tool. Go to Edit > Virtual Machine 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.

© 1998-2003 VMware, Inc. All rights reserved.