[OpenIndiana-discuss] Best way to map SAS drives to physical positions

Edward Ned Harvey openindiana at nedharvey.com
Thu Oct 6 14:09:11 UTC 2011

> From: Jeppe Toustrup [mailto:openindiana at tenzer.dk]
> I have an OpenIndiana server connected to a 12 drive JBOD chassis
> through SAS, and I am trying to figure out the best way to find out
> which physical drive in the chassis resolves to each of the drive
> names visible from the operating system.

There is an official script available from oracle support, and it doesn't do
anything better than this:

prtconf -v /dev/dsk/c2t5000C50034242B55d0s2
Look for "phy-num" and "obp-path"  The phy-num is a physical hardware
location, that doesn't necessarily match the slot number, and the obp-path
indicated which controller it's on.
Repeat for each of the devices present in your system.

Truncate the obp-path.
/pci at 0,0/pci8086,340a at 3/pci1000,3050 at 0/disk at w5000c50034242b55,0
	after: /pci at 0,0/pci8086,340a at 3/pci1000,3050 at 0/

As a one-time exercise, make a lookup table.  If you know the phy-num and
the truncated obp-path of any given device, then you can lookup the slot
based on that information.  But you have to create a lookup table once.
In my example above, I have a lookup table populated with entries like this:
0 0000000b /pci at 0,0/pci8086,340a at 3/pci1000,3050 at 0/

where 0 is the actual slot number where I can go find the disk with my hands
and eyeballs in the server room, 0000000b is the phy-num, and /pci...3050 at 0/
is the truncated obp-path that is associated with c2t5000C50034242B55d0s2

Side note:  It just so happens, on my system, my phy-num and slot numbers
are reverses of each other.  Slot 0 is phy-num b, and slot 11 is phy-num 0.
As one counts up, the other counts down.  Emphasizing the importance of NOT
thinking phy-num is the slot num.  But it can be used to find the slot num.

My initial lookup table was created like this:
With only a single disk in the system, I see what slot it's in, I get the
phy-num and obp-path, record it in a file.  Add a new disk.  Lookup the
phy-num and obp-path, record it in a file.  Add another disk...

If you can't pull disks from your system, you can figure it out by doing
something like "dd if=/dev/rdsk/c2t5000C5000blah of=/dev/null" or "zpool
offline mypool c2t5000C5000blah"  to make a specific device stay lit up, or
stay off for a little while, so you can find which slot that disk is in.

I suppose you could skip the whole mess above regarding phy-num and
obp-path...  Just make a map "c2t5000C5000blah is in slot X" or whatever...
But I suspect it will be more reliable if you actually dig down and get the
phy-num and obp-path.

More information about the OpenIndiana-discuss mailing list