I needed to use a raw physical disk from within a VMware image. This works in VMware Workstation and apparantly also in Server 1.x but somehow the ability to use physical disks was removed from the UI of Server 2.0. While I could find some posts about this on the forum none of them really helped me any further. After a lot of fiddling and comparing with VMware Workstation I finally found how to make it work. I hope this is usefull for somebody. If it isn't, just ignore me
I used the following setup:
Server OS | CentOS 5.2 64-bit |
Vmware version | Server 2.0 build 116503 |
Server disk | /dev/sda (system disk)
/dev/sdb to be used by the vm guest |
Guest name | 'barbar' |
Guest OS | CentOS 4 (not really relevant) |
Guest storage | small virtual disk for the OS
/dev/sdb |
My server has 2 'disks': /dev/sda is a local raid used for storing the server os and guest images, /dev/sdb is a chunck of a SAN connected via fiberchannel which will be used by one particular guest called 'barbar'.
Make sure the guest is powered off before making any changes
The configuration of the VMware guest image is stored in the <guestname>.vmx file in the guests directory. The virtual disk configuration consists of a few lines which read like this:
-
scsi0:1.present = "TRUE"
scsi0:1.fileName = "barbar-0.vmdk"
scsi0:1.deviceType = "rawDisk"
-
Note the '0:1' denotes the second disk on the first SCSI channel. This is because I'm using 2 disks in the guest: the virtual disk which will hold the OS and the physical disk which will show up as the second disk.
The vmx file does not contains any references to the actual physical disk I want to use (/dev/sdb). This information is stored in a second file (in this case barbar-0.vmdk) This file looks like:
-
Disk DescriptorFile
version=1
CID=e6704746
parentCID=ffffffff
createType="fullDevice"
Extent description
RW 419430400 FLAT "/dev/sdb" 0
The Disk Data Base
#DDB
ddb.toolsVersion = "0"
ddb.encoding = "UTF-8"
ddb.adapterType = "lsilogic"
ddb.geometry.biosSectors = "63"
ddb.geometry.biosHeads = "255"
ddb.geometry.biosCylinders = "26108"
ddb.geometry.sectors = "63"
ddb.geometry.heads = "255"
ddb.geometry.cylinders = "26108"
ddb.virtualHWVersion = "6"
-
Disk DescriptorFile I have no idea what the first set of options do. I copied these from a Workstation 6.0.4 setup.
Extent description this line defines which physical device will be used. In this case I'm using my secondary disk which is /dev/sdb. The number is very importan, this is the size of the disk in 512b blocks. You can find this by doing 'fdisk /dev/sdb' on the server
-
fdisk /dev/sdb
Command (m for help): p
Disk /dev/sdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 26108 209712478+ fd Linux raid autodetect
-
214748364800 / 512 = 419430400
ddb.geometry* make sure these also match the geometry of the physical disk. Again you can get this from 'fdisk /dev/sdb' on the server.
The ddb.geometry* info seems to be less important, however the size in the Extent description should be correct otherwise the image won't start.
now start the guest from the console. The physical disk will not show up in the guest summary screen, however when you now run 'fdisk /dev/sdb' from within the guest you should see the partition table of the real physical disk
I hope this is useful to somebody
Nico