HOWTO: Use Raw disk vmdk created by VirtualBox in VMware

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Macboy
Posts: 8
Joined: 26. Oct 2008, 14:47

HOWTO: Use Raw disk vmdk created by VirtualBox in VMware

Post by Macboy »

No, I am not asking "how do I". This is a how-to. It explains; it doesn't ask.

HOWTO Use a Raw/Physical disk vmdk created by Virtualbox as a SCSI disk in VMware:

I wanted to compare performance and stability of VMware Player to VirtuaBox (since I am not happy with either aspect in VirtualBox) but I was having trouble getting VMware player to recognize the physical disk vmdk's I was using with VirtualBox. After much ado about nothing, I figured it out and wanted to share. It turns out that VirtualBox creates slightly mangled vmdk files which VMware does not like. Since the good folks at VMware created the vmdk specification, I would call this a bug on VirtualBox's part. But I digress.

Here is an example *.vmdk file, as created by VirtualBox and functional in VirtualBox (not in VMware). This is an 80 GB disk with two paritions: a 12 GB partition and a 64 GB partiion. Only the first one is made visible to the VM.

Code: Select all

# Disk DescriptorFile
version=1
CID=526c949e
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 63 FLAT "myDisk-pt.vmdk"
RW 24579387 FLAT "\\.\physicaldrive0" 63
RW 131716935 ZERO
RW 5103 ZERO

# The Disk Data Base
#DDB
ddb.adapterType = "ide"
ddb.geometry.biosSectors = "63"
ddb.geometry.biosHeads = "255"
ddb.geometry.biosCylinders = "1024"
ddb.geometry.sectors = "63"
ddb.geometry.heads = "16"
ddb.geometry.cylinders = "16383"
ddb.virtualHWVersion = "4"
ddb.toolsVersion = "0"
When attempting to use this in VMware, all the user gets is a cryptic message about not being able to find the file. What VMware really means is that it can't find all the extents that make up the disk so the disk can't be used.

Here's the fixed version that works in VMware (and should still work in VirtualBox):

Code: Select all

# Disk DescriptorFile
version=1
CID=526c949e
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 63 FLAT "myDisk-pt.vmdk" 0
RW 24579387 FLAT "\\.\PhysicalDrive0" 63
RW 131716935 ZERO
RW 5103 ZERO

# The Disk Data Base
#DDB
ddb.adapterType = "ide"
ddb.geometry.biosSectors = "63"
ddb.geometry.biosHeads = "255"
ddb.geometry.biosCylinders = "1024"
ddb.geometry.sectors = "63"
ddb.geometry.heads = "16"
ddb.geometry.cylinders = "16383"
ddb.virtualHWVersion = "4"
ddb.toolsVersion = "0"
Obvious isn't it? Ok, two subtle issues with the VirtualBox vmdk file. First, there was no offset specified for the first partition. It must be specified as 0 (zero). VirtualBox seems OK if this is absent, but VMware is not. Second, VMware seems to be case-sensitive so the "p" and "d" in physicaldrive0 need to be caps: "PhysicalDrive0" not "physicaldrive0". Tada: VMware now opens and successfully uses the physical disk 0 partition 1.

There is still another problem (maybe). This is an IDE disk specifier. But if you want to use, for example, a bunch of big cheap SATA drives in a RAID array within the VM (like I am), then you are in trouble. VirtualBox has a multi-port virtual SATA adapter, but VMware does not. VMware does however use SCSI, just as good or better. The only problem is converting the disk.

Here's how to convert from IDE to SCSI:
Add up the sizes in the extent description to get the total size of the disk. In this case, 63 + 24579387 + 131716935 + 5103 = 156301488. Now divide by 255 and again by 63. In this case, 9729.3176 , so I'll round down to 9729. This is the "cylinders" value. Set sectors to "63" and heads to "255", then set adapter type to "lsilogic", get rid of the bios stuff, and you are good to go. Here is the resulting SCSI disk vmdk for VMware to access the physical drive:

Code: Select all

# Disk DescriptorFile
version=1
CID=526c949e
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 63 FLAT "myDisk-pt.vmdk" 0
RW 24579387 FLAT "\\.\PhysicalDrive0" 63
RW 131716935 ZERO
RW 5103 ZERO

# The Disk Data Base
#DDB
ddb.adapterType = "lsilogic"
ddb.geometry.sectors = "63"
ddb.geometry.heads = "255"
ddb.geometry.cylinders = "9729"
ddb.virtualHWVersion = "4"
ddb.toolsVersion = "0"
Post Reply