Contents

Enabling a Raw Disk from a Virtual Machine

A raw disk is a physical IDE or SCSI disk that your host operating system detects. For example, with Linux as the host operating system, the IDE raw disks are /dev/hda through /dev/hdh. The SCSI raw disks are /dev/sda through /dev/sdp.

VMware GSX Server supports only raw disk partitions on IDE drives. Booting guest operating systems on raw SCSI drives is not supported. While booting from a SCSI raw disk may work, it is possible there may be incompatibilities between your SCSI adapter and the BusLogic adapter VMware GSX Server implements. However, if a virtual machine is configured with a virtual disk, instead of a raw disk partition, then its disk file can be stored on the file system, regardless of whether the underlying drive(s) containing the file system are IDE or SCSI.

To access each raw IDE device on the host machine, VMware GSX Server uses description files that contain access privilege information for controlling a virtual machine's access to certain partitions on the disks. This mechanism prevents users from accidentally trying to run the host operating system again as a guest or another guest operating system for which the virtual machine was not configured. The description file also prevents accidental writes to raw disk partitions from badly behaved operating systems or applications.

Safe Raw Disks

A safe raw disk file is a small file that describes how the different parts of a raw disk should be accessed by a virtual machine. The sample below shows the content of my_first_safe_raw_disk, a typical safe raw disk file for a Windows NT virtual machine running inside VMware GSX Server.

===
DEVICE /dev/hda
# Partition type: MBR
RDONLY 0 62
# Partition type: HPFS/NTFS
ACCESS 63 8193149
# Partition type: Linux swap
NO_ACCESS 8193150 8466254
===

The virtual machine can access the /dev/hda raw disk. The access information for sectors on the raw disk is as listed in the following table.

Partition Type Sectors Access Rights
Boot information 0 through 62 inclusive Read-Only
NTFS or FAT 63 through 8193149 inclusive Read-Write
Linux swap 8193150 through 8466254 inclusive Forbidden

If the guest operating system inside the virtual machine attempts a forbidden read or write operation to the safe raw disk, VMware GSX Server displays a pop-up window asking the user to authorize or deny the access.

Installing a Safe Raw Disk in a Virtual Machine

  1. Determine which raw disk you would like to access from a virtual machine.
  2. Set the device group membership or device ownership on the host computer.

    The master raw disk device(s) needs to be readable and writable by the user who runs VMware GSX Server. On most distributions, the raw devices (such as /dev/hda, /dev/hdb) belong to group-id disk. If this is the case, you can add VMware GSX Server users to the disk group. Another option is to change the owner of the device. Please think carefully of security in exploring different options here.

    It is typically a good idea to grant VMware GSX Server users access to all /dev/hd[abcd] raw devices that contain operating systems or boot managers and then rely on VMware GSX Server's raw disk configuration files to guard access. This helps provide boot managers access to configuration and other files they may need to boot the operating systems. For example, LILO needs to read /boot on a Linux partition to boot a non-Linux operating system that may be on another drive.

  3. Open the Configuration Editor in the virtual machine for which you want to create a safe raw disk.
  4. Click the + sign beside IDE Drives or SCSI Devices.
  5. Look for Not installed drives. If there are none, your virtual machine is already configured with four IDE drives or seven SCSI drives and you cannot configure another one unless you remove one of the configured drives. To do this, click the one you want to remove, then click Remove.
  6. Click a Not Installed drive. For example, if you choose P-S Not Installed under IDE, the virtual machine sees your raw disk as the slave IDE device of the primary IDE controller. If you choose SCSI 0:1 Not Installed under SCSI, the virtual machine sees your raw disk as a device with SCSI ID 1 on the SCSI controller.
  7. Set the Device Type field to Raw Disk.
  8. Set the Name field to the name of your safe raw disk file (for example, enter my_first_safe_raw_disk).
  9. Click the Create button.
  10. Set the Device to your raw disk device (for example, enter /dev/hda for IDE devices or /dev/sda for SCSI devices).

    A new window appears, displaying a list of partitions present on your raw disk.

  11. For each partition, select the access rights for the virtual machine. At this point, you need to know what access rights your guest operating system needs.

    The following options are possible:

  12. Click Save. A pop-up window may warn you that two partitions overlap (they have a range of sectors in common) and that consequently they should have the same access rights. If this is the case, change the access right of one of these two partitions, then try clicking Save again.
  13. The safe raw disk file is now written in your virtual machine directory. Click Install to actually connect the raw disk to your virtual machine.

    You are now ready to have your raw disk used by your virtual machine.

  14. As with a virtual disk, you should decide in which mode (persistent, non-persistent or undoable) you want to use the raw disk.

Before booting your virtual machine, please read Potential Issues With Using Raw Disks carefully. If you need to install an operating system on the raw disk, you may want to read Installing a Guest Operating System Onto a Raw Disk Partition. If there is already an operating system on the raw disk and you want to use it sometimes as a host operating system and sometimes as a guest operating system, you may want to read Setting Up Virtual Machines On a Dual-Boot System.

Removing a Safe Raw Disk from a Virtual Machine

  1. Open the Configuration Editor in the virtual machine from which you want to remove the safe raw disk.
  2. Click the + sign to expand the IDE Drives or SCSI Drives node.
  3. Look for raw disk drives. Click the one you want to remove.
  4. Click Remove.

Modifying a Safe Raw Disk

You can modify a safe raw disk file that has been generated previously. If you want to use another raw disk or if you have modified the layout of the partitions on the raw disk, first remove the safe raw disk file, then create a new safe raw disk file corresponding to the new raw disk.

If the raw disk has not changed, but you want to change the virtual machine's access rights to the raw disk (which means that you want to modify the safe raw disk file), click Edit Raw Disk, modify the appropriate settings, then click Save.

Risks in Using Raw Disks

Raw disks are safe if used correctly. One of the dangers in using raw disks is simultaneous access to a partition by multiple users. That is, a raw disk partition should not be simultaneously used (mounted) by the host and the guest operating system. Because each operating system is unaware of the other, data corruption may occur if both operating systems read or write to the same partition. The purpose of safe raw disk files is to regulate disk operations in the guest operating system. Currently, VMware GSX Server does not regulate disk operations in the host operating system.

Consequently, you should ensure that your host operating system does not see the partitions with which your guest operating system works. The safety of raw disks depends only on this requirement.

If you need to exchange data between a host and a guest operating system, either serialize disk accesses (for example on Linux, mount the raw disk, put the data on it, unmount the disk, start the virtual machine, read the data, stop the virtual machine), or use network protocols such as SMB (Windows networking, implemented by Samba under Linux) or NFS.

Frequently Asked Questions

Question

Answer

What does this message "The partition information in file <your Safe Raw Disk> doesn't match that of device <your Device field>." mean?

It means the Configuration Editor has detected that the access rights in your safe raw disk file cannot be applied to the list of partitions present on the device you specified in the Device field.

It typically happens in these cases:

  • The raw disk used to create the safe raw disk file is different from the one you typed in the Device field.
  • You have modified the layout of the partitions on the raw disk. This can happen when:
    • You have replaced a drive in the physical machine.
    • You have moved the safe raw disk file to another physical machine.

To get rid of this message, the safest thing to do is to remove the safe raw disk file.

Can I move a safe raw disk file from one physical machine to another?

No, unless both machines have disks with identical content. Otherwise, VMware GSX Server detects the situation and issues a warning message as described previously.

Can I mix raw disks and virtual disks in the same virtual machine?

Yes. This feature is particularly useful when you want to transfer data to a virtual disk. However, be aware of potential issues described in Potential Issues With Using Raw Disks, below.

Potential Issues With Using Raw Disks

Raw disks offer a reliable way to store your data if used correctly. However, be aware of the following:

Related topics:

Back to top

© 2001-2002 VMware, Inc. All rights reserved.