Providing vmware guest access to a physical disk driver hosted on Linux

  • 7001976
  • 20-Nov-2008
  • 27-Apr-2012

Environment

Mostly desktop users and specifically those who login with a non-root account.

Situation

First configure VMWare guest to use physical disk partition as a Root user

- Note that as a Root user the message which appears next to the Hard Disk in the Guest says, "Using Partitions"
- Now login as the non-root user and note the message which appears next to the Hard Disk in the Guest which reports "Using Device"

1. This problem occurs because the non-root user does not have RW access to the required Linux device driver.

2. Granting the non-root user permissions or changing ownership to the device, e.g. /dev/sdb will not work after a reboot
     At Linux boot time (each time) disk device drivers files are created

Resolution

A) Firstly identify the type of disk device used by the vmware guest

- Look at the device name on YOUR system (as per the sample vmdk file), using root permissions:
- at a terminal window:
    # ls -al /dev/sdb
       brw-r----- 1 root disk 8, 16 Nov 21 11:20 /dev/sdb

 - Note that 'b' means block and the 8, 16 identify the device as per the file devices.txt (e.g. /usr/src/linux-2.6.25.18-0.2/Documentation/devices.txt)

A) Add these commands to "/etc/init.d/boot.local",
      - where 'myuser' is the non-root user name:
      - AND using the block device numbers returned on YOUR system
      - name the device something that is not already in directory /dev. (It will be the name you place in the vmdk file in the next step)

mknod /dev/sdbvm b8 16
chown myuser:disk /dev/sdbvm

B) Edit the appropriate vmware guest vmdk file (only edit the device name):

Sample of portion of vmware file: WinXP-Notebook-0.vmdk
# Extent description
RW 63 FLAT "WinXP-Notebook-0-pt.vmdk" 0
RW 146801907 FLAT "/dev/sdbvm" 63
RW 37752750 FLAT "/dev/sdbvm" 146801970
RW 440582625 ZERO
RW 5103 ZERO

No doubt this could be made to work with any user by using a variable in the boot.local

Additional Information

The reason for this specific disk setup is to boot Windows from a vmdisk but have access to a physical NTFS disk partition for data. Also provides access to a FAT32 physical disk partition located on the same physical disk as NTFS partition, for the purpose of shared file access between Linux host and Windows guest.

Feedback service temporarily unavailable. For content questions or problems, please contact Support.