Raw Device Mapping (RDM) is a a method to pass a physical drive (that is detected by ESXi) to a virtual machine without first creating a Datastore and a virtual hard disk inside it.
Here is how to setup a drive with RDM to a VM:
- Enable SSH on the host. Log in to the physical ESXi host. Under Troubleshooting Options select Enable SSH.
- Log in to the host with your favorite SSH client
- Find out what the disk is called by issuing the command:
ls -l /vmfs/devices/disks/
The device is called something like:
t10.ATA_____SAMSUNG_HD103SJ___________S246JDWS90XXXX______
Make sure you determine the correct drive to use for the RDM. Entries with the same beginning as above but ending with :1 is a partition. This is not what you want, you want to map the entire drive. - Find your datastore by issuing the command:
ls -l /vmfs/volumes/
It should be named something like:
Datastore1 -> 509159-bd99-… - Go to your Datastore by issuing the command:
cd /vmfs/volumes/Datastore1
(Type ls and you will see the content of this Datastore) - Here comes the actual mapping. Issue the command:
vmkfstools -z /vmfs/devices/disks/<name of disk from step 3> <RDM>.vmdk
Where you replace the <name of disk from step 3> with the actual disk name and <RDM>with what you would like to call the RDM. A concrete example:vmkfstools -z /vmfs/devices/disks/t10.ATA_DISKNAME_ SamsungRDM.vmdk - Log in to the vSphere client
- Shutdown the virtual machine that you want to add the RDM to
- Open the settings for the virtual machine
- Under hardware tab, click Add…
- Select Hard Disk and press Next
- Select Use an existing virutal disk
- Press Browse, go to the datastore we found in step 4 and select theSamsungRDM.vmdk we created in step 6.
- Press Next, Next and Finish to finalize the add hardware guide.
The hard drive is now added to the VM. Just start it up and start using the drive.
Note 1: I was trying to be a smart ass by using the path /dev/disks/ instead of /vmfs/devices/disks/ to point out the disk for theĀ vmkfstools and it refused to accept it.
Note 2: SMART monitoring does not work on drives used as RDM.