VMWare / Linux: Map SCSI LUNs to sd (storage device id)
by jfargen on Oct.26, 2012, under Work and stuff
Hopefully one day you won’t come upon a server running ESX / Linux that has become unresponsive to regular management tools and view something like this completely filling your console:
sd 7:0:2:0 still retrying after 360s
I knew instantly 7:0:2:0 was a SCSI mapping for host, bus, scsi id, etc, etc. These hosts are using SATA drives and I needed to be able to us hdparm to determine the serial number of the drive for local support to replace. After digging I came up the command sg_map matched with -x option prints after each active sg device name is displayed there are five digits: <host_number> <bus> <scsi_id> <lun> <scsi_type>.
When I ran sg_map -x this provided me with exactly what I need: /dev/sg2 7 0 2 0 0 /dev/sdc. You can see that sdc is mapped to SCSI address 7:0:2:0. With this information I was able to use hdparm -i /dev/sdc to extract the serial number of the drive and provide it to local hands and feet support in Germany to swap out the failing hard drive.