You are hereOther / ESXi 4 update1 with a SATA drive as a raw device

ESXi 4 update1 with a SATA drive as a raw device


By maho - Posted on 20 June 2010

One day I decided that I needed to replace the old "server" I use at home for various tasks, I ended up with a new shiny i7 system, enough gigs of RAM and loads of storage. Beeing sort of a geek and most of all "root" I kinda had to run VMWare ESXi on that box, after fighting ESXi with every NIC I could find laying around the appartment I finally found one that was accepted, some old Intel 1000pro card. Anyway, back to the point. With the ESXi setup completed I started to setup my fileserver in it's new virtual clothes little did I know that you can not use a SATA disk as a raw device for a virtual machine and I have no plans on making huge virtual disks of my physical drives. So, how do I get ESXi to allow me to use my existing drives? one possibility was to enable passthrough for the controller and add it to the virtual host but doing so will limit the functionality of the virtual host and we don't want that. After digging around for a few minutes I found this solution that to me seemed to be good enough.

Before we go on maybe I should say that I've stolen most this information from various blogs found through google and adapted it to what I wanted to achieve.

Make sure that there are no virtual machines running, if there are you will probably get strange error messages that makes no sense at all.

First we need to list all disk (and partitions) available to determine the name of our volume:

~ # fdisk -l
Disk /dev/disks/t10.ATA_____WDC_WD15EARS2D00Z5B1__________________________WD2DWMAVU1994709: 1500.3 GB, 1500301910016 bytes
64 heads, 32 sectors/track, 1430799 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

                                                                                 Device Boot      Start         End      Blocks  Id System
/dev/disks/t10.ATA_____WDC_WD15EARS2D00Z5B1__________________________WD2DWMAVU1994709p1             1   1430799 1465138160   83  Linux

Alright the above has been cut down to one drive and it's partitions, what you should see is a complete list of all your disks and partitions, figure out the device name of the disk you want to access and find the symlink to it in /dev/disks.
When we have found our disk device use vmkfstools to greate a VMWare Passthrough device map for it, make sure to put this in a datastore that your virtual machine can access also make sure to map the entire disk and not a partition.

~ # cd /vmfs/volumes/4b6df706-d7c26a58-6fb4-000e0c06277d (this is the datastore where I want to put the disk file)
/vmfs/volumes/4b6df706-d7c26a58-6fb4-000e0c06277d # vmkfstools -z /vmfs/devices/disks/t10.ATA_____WDC_WD15EARS2D00Z5B1__________________________WD2DWMAVU1994709 FS-DISK2.vmdk -a lsilogic

 

The content of your newly created file should look something like this:

/vmfs/volumes/4b6df706-d7c26a58-6fb4-000e0c06277d # cat FS-DISK2.vmdk
# Disk DescriptorFile
version=1
encoding="UTF-8"
CID=160b505f
parentCID=ffffffff
createType="vmfsPassthroughRawDeviceMap"

# Extent description
RW 1953525168 VMFSRDM "FS-DISK2-rdmp.vmdk"

# The Disk Data Base
#DDB

ddb.virtualHWVersion = "7"
ddb.longContentID = "de72ba75011016270c2f249b160b505f"
ddb.uuid = "60 00 C2 94 a1 0c b6 ae-76 a8 5a 07 4d 30 44 a6"
ddb.geometry.cylinders = "121601"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.adapterType = "lsilogic"
 

Edit you virtual machine and add and existing virtual disk to it, browse for the newly created disk and you should be able to access the raw device.

Hej Mattias,

This looks like a neat solution on the raw device mapping (RDM) problem.
I know only MS Hyper-v is capable of this in a supported way out of the box.

Are you planning to have use this solution as permanent? What is your experience so far? How many disks are you planning to deploy?

I have been looking for RDM for quote some time now. I'm planning to use the ESXi server to Nexentastor (Opensolaris based storage OS) or perhaps FreeNAS for 6 disk configured in a ZFS pool (similar to RAID5/6).

I plan to store all my personal movies, pictures together with my movie collection.
I need a stable and reliable system. Wonder if this is the answer??

Hi Rickard,

Currently I use this solution for my file server, nothing fancy but still roughly 7.5TB split over 5 disks all attached to a virtual machine, this how ever is not in a production environment and I would not suggest using this for anything but home use where everything *important* is backed up so reliable media. That said, I have not encountered any performace or stability issues not anticipated with non enterprise hardware, but then again with enterprice hardware we would not need to go down this path. I am actually about to add a Adaptec 48300 hoping that will allow a more serious way to use my drives with vmware, but first I need to get more PCI slots..

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.