[an error occurred while processing this directive] Using Raw Disks With VMware Workstation for Linux [an error occurred while processing this directive] [an error occurred while processing this directive]
 
Using Raw Disks With VMware Workstation for Linux

This document explains issues involved in using raw disks with VMware Workstation for Linux.


Raw Disks
A raw disk is a physical IDE or SCSI disk that your host operating system knows about. 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.


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. For example:

Here is the content of "my_first_safe_raw_disk", a typical safe raw disk file for a Windows NT virtual machine running inside VMware Workstation for Linux:

===
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 will be able to access the /dev/hda raw disk. The access information for sectors on the raw disk is as follows

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 Workstation will display 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 writeable by the user who runs VMware Workstation. 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 Workstation 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 Workstation users access to all /dev/hd[abcd] raw devices that contain operating systems or boot managers and then rely on VMware Workstation'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 Drives.
  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 will not be able to configure another one unless you remove one of the configured drives. To do this, click the one you want to remove, then click the Remove button.
  6. Set the Device Type field to Raw Disk.

  7. Click a Not Installed drive. For example, if you choose P-S Not Installed under IDE, the virtual machine will see 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 will see your raw disk as a device with SCSI ID 1 on the SCSI controller.
  8. Set the Device Type field to Raw Disk
  9. Set the Name field to the name of your safe raw disk file (for example, my_first_safe_raw_disk).
  10. Click the Create Raw Disk button.

  11. Set the Device to your raw disk device (for example, /dev/hda for IDE or /dev/sda for SCSI)
  12. A new window appears, displaying a list of partitions present on your raw disk.
  13. For each partition, select the access rights the Virtual Machine will have. At this point, you need to know what access rights your guest operating system will need. Here are a few tips to help you with this step:

    The following options are possible:

    • No Access - The virtual machine will not be able to read or write on the partition at all. Use it only if you suspect that your guest operating system is buggy, and if you want to track random off-range read accesses.
    • Read/Write - The virtual machine will be able to read from and write to the partition. Use it for partitions that your guest operating system knows about natively.
    • Read-Only - The virtual machine will only be able to read data from the partition. Use it everywhere else.

  14. Click the Save button. Sometimes a pop-up window will 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, and try clicking the Save button again.
  15. The safe raw disk file is now written in your virtual machine directory. Click the Install button to actually connect the raw disk to your virtual machine.
  16. You are now ready to have your Raw Disk used by your Virtual Machine.

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 this section carefully.

If you need to install an operating system on the raw disk, you may want to look at the tech note Installing an Operating System onto a Raw Partition from a Virtual Machine Using VMware Workstation for Linux. 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 look at the tech note Configuring Dual/Multiboot Systems to Run With VMware Workstation for Linux.


Removing a Safe Raw Disk from a Virtual Machine

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


Modifying a Safe Raw Disk
A safe raw disk file has been generated previously (either because you used the Configuration Wizard or because you used the Configuration Editor as described above in this document) and you would like to modify it.

If you want to use another raw disk or if you have modified the layout of the partitions on the raw disk, first see above to remove (or rename) the safe raw disk file, then go to the installation section of this document to create a new safe raw disk file corresponding to the new raw disk.

If, on the contrary, the raw disk hasn't 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 the Edit Raw Disk... button, follow the steps in the Edit Raw Disk... paragraph of the installation section of this document, then click the Save button.


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 Workstation does not regulate disk operations in the host operating system.

Consequently, you should ensure that your host operating system doesn't "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 VMware Workstation, read the data, stop VMware Workstation), or use network protocols such as SMB (Windows networking, implemented by Samba under Linux) or NFS.


Frequently Asked Questions

  1. 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 (see above).

  2. 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 Workstation will detect the situation and issue a warning message described above in question 1.
  3. Can I mix raw disks and virtual disks in the same virtual machine?
    Yes. This feature is particularly useful when you want to transfer a lot of data to a virtual disk.
[an error occurred while processing this directive]