Monday, July 12, 2010

Identifying RDM mappings End-to-End in ESXi4

When you're using RDMs in ESXi4 - it's just so easy to fall back to a standard non-VMware box if so - it can be hard to ensure the disk you're modifying/replacing is the correct one.  Here's one method of checking that you're on the right disk:
~ # grep scsi0:4.fileName /vmfs/volumes/datastore1/alligator/alligator.vmx
scsi0:4.fileName = "/vmfs/volumes/4b918cf4-f5f48288-506c-0030489f09a1/gator/gatorsdc.vmdk"

~ # cd /vmfs/volumes/4b918cf4-f5f48288-506c-0030489f09a1/gator
~ # vmkfstools -q gatorsdc.vmdk
Disk gatorsdc.vmdk is a Non-passthrough Raw Device Mapping
Maps to: vml.0100000000533133554a314b5136303035333520202020202053414d53554e
esxcfg-scsidevs  -u| grep \
 vml.0100000000533133554a314b5136303035333520202020202053414d53554e
t10.ATA_____SAMSUNG_HD753LJ_________________________S13UJ1KQ600536______vml.0100000000533133554a314b5136303035333520202020202053414d53554e

And hey, look! 

On linux, then, /dev/sde (0:4) is our Samsung HD753 with serial number S13UJ1KQ600536 .  That's almost too easy. But be careful, though, as one misstep will probably hose something in ways you really don't want.  Measure twice, hack once.