May 25 2013

Attach a RAW Hard Drive to an ESXi Guest

I’m always thinking about my servers and how I can either condense them, learn something new from them, or simply mess around with them. Well, recently I discovered just now easy it can be to connect a hard disk directly to an ESXi guest allowing the virtual machine to directly access the information on the drive.

I even tested the set up by pulling the drive out of the server and into a SATA dock on my main computer. I was able to directly browse the files that the ESXi guest had written to the drive.

Here are the steps I took.

I first needed to find out the full name of the hard drive I wanted to directly access. I also needed to make sure that if there were any datastores on the drive, they got deleted.

I navigated to the /dev/disks directory and used ls -l to view all of the drive names. I then found the name of the drive I wanted to use. It looked something like this:


Now we can create the magical link and get a vmdk to add to our virtual machine. Use the following line to do this.

vmkfstools -z /vmfs/devices/disks/<name of RAW device> <location to store VMDK>/<RDM name>.vmdk

With that, you will be able to log into your vSphere client and add this hard drive to any virtual machine!