rageek

A place for Unix Thoughts and Ideas

Mapping Disk Device to Slot number on T3/T4 based Systems

I’m starting to play around with my new T4-2 & T4-4 systems and have noticed the change on the disk devices from the previous c?t?d? format to WWN format for the T3 and T4 based systems.

This causes issues with some of my scripts and also in knowing which device is in which slot.

In Solaris 10 update 10 the diskinfo utility will print the mapping, but it only will print for the first controller, which can make it problematic for the T4-1 and T4-4 systems which have 2 controllers. This supposed to be fixed in update 11.

Oracle outlines the process for finding the information through prtconf
http://docs.oracle.com/cd/E22985_01/html/E22986/z40000091523716.html

Which is good, but a 1-liner is much easier to use:

here is the output of diskinfo:

 
root@testserver # diskinfo -a

Enclosure path:         1Xxxxxxx-physical-hba-0
Chassis Serial Number:  1xxxxxx-physical-hba-0
Chassis Model:          ORCL,SPARC-T4-2

Label            Disk name               Vendor   Product          Vers
----------------------  -------- ----
/SYS/SASBP/HDD0  c0t5000CCA012B66D58d0   HITACHI  H106030SDSUN300G A2B0
/SYS/SASBP/HDD1  c0t5000CCA012B7368Cd0   HITACHI  H106030SDSUN300G A2B0
/SYS/SASBP/HDD2  c0t5000CCA012B73594d0   HITACHI  H106030SDSUN300G A2B0
/SYS/SASBP/HDD3  c0t5000CCA012B7314Cd0   HITACHI  H106030SDSUN300G A2B0
/SYS/SASBP/HDD4  c0t5000CCA012B66DDCd0   HITACHI  H106030SDSUN300G A2B0
/SYS/SASBP/HDD5  c0t5000CCA012B613B4d0   HITACHI  H106030SDSUN300G A2B0

Not to bad.

But on a T4-4 it is a bit more problematic, it isn’t showing the second drive

root@testserver # diskinfo -a

Enclosure path:         1xxxxxxxxx-physical-hba-0
Chassis Serial Number:  1xxxxxxxxx-physical-hba-0
Chassis Model:          ORCL,SPARC-T4-4

Label      Disk name               Vendor   Product          Vers
---------- ----------------------  -------- ----
/SYS/MB/HDD0 c0t5000CCA02522A838d0   HITACHI  H106030SDSUN300G A2B0

Here is how to get the WWN PhyNum information for the drive:

For controller 0, PhyNum = slot number, for controller 1, PhyNum + 4 = the slot number.

root@t4test #  prtconf -v | sed -e :a -e '$!N;s/\n[ ]*value=/ /;ta' -e 'P;D' |  sed -n '/mpt_sas#/!d;p;n;n;n;p;n;p;n;p'
                mpt_sas#1 (online)
                    name='target-port' type=string items=1 '5000cca012b66d59'
                    name='obp-path' type=string items=1 '/pci@400/pci@2/pci@0/pci@e/scsi@0/disk@w5000cca012b66d59,0'
                    name='phy-num' type=int items=1 00000000
                mpt_sas#2 (online)
                    name='target-port' type=string items=1 '5000cca012b7368d'
                    name='obp-path' type=string items=1 '/pci@400/pci@2/pci@0/pci@e/scsi@0/disk@w5000cca012b7368d,0'
                    name='phy-num' type=int items=1 00000001
                mpt_sas#3 (online)
                    name='target-port' type=string items=1 '5000cca012b73595'
                    name='obp-path' type=string items=1 '/pci@400/pci@2/pci@0/pci@e/scsi@0/disk@w5000cca012b73595,0'
                    name='phy-num' type=int items=1 00000002
                mpt_sas#4 (online)
                    name='target-port' type=string items=1 '5000cca012b7314d'
                    name='obp-path' type=string items=1 '/pci@400/pci@2/pci@0/pci@e/scsi@0/disk@w5000cca012b7314d,0'
                    name='phy-num' type=int items=1 00000003
                mpt_sas#5 (online)
                    name='target-port' type=string items=1 '5000cca012b66ddd'
                    name='obp-path' type=string items=1 '/pci@400/pci@2/pci@0/pci@e/scsi@0/disk@w5000cca012b66ddd,0'
                    name='phy-num' type=int items=1 00000004
                mpt_sas#6 (online)
                    name='target-port' type=string items=1 '5000cca012b613b5'
                    name='obp-path' type=string items=1 '/pci@400/pci@2/pci@0/pci@e/scsi@0/disk@w5000cca012b613b5,0'
                    name='phy-num' type=int items=1 00000005

Also, for a Tx-1 & Tx-4 based systems, you need to add 4 to the phy-num to get the slot number. This is illustrated in this output

 
root@t44test #  prtconf -v | sed -e :a -e '$!N;s/\n[ ]*value=/ /;ta' -e 'P;D' |  sed -n '/mpt_sas#/!d;p;n;n;n;p;n;p;n;p'
                mpt_sas#4 (online)
                    name='target-port' type=string items=1 '5000cca02517fbf5'
                    name='obp-path' type=string items=1 '/pci@400/pci@1/pci@0/pci@0/LSI,sas@0/disk@w5000cca02517fbf5,0'
                    name='phy-num' type=int items=1 00000000
                mpt_sas#2 (online)
                    name='target-port' type=string items=1 '5000cca0251f05ad'
                    name='obp-path' type=string items=1 '/pci@700/pci@1/pci@0/pci@0/LSI,sas@0/disk@w5000cca0251f05ad,0'
                    name='phy-num' type=int items=1 00000000

Pretty good, but not very useful for scripts.

To get just the WWN’s/Devices, in order of enumeration..

root@t44test # prtconf -v | sed -e :a -e '$!N;s/\n[ ]*value=/ /;ta' -e 'P;D' | sed -n '/mpt_sas#/!d;n;p' | cut -d\' -f4 | tr '[a-z]' '[A-Z]' | sed -e '
s/^/c0t/' -e 's/$/d0/'
c0t5000CCA02517FBF4d0
c0t5000CCA0251F05ACd0

This would work on a T4-2/T3-2 system or T4-1B where there is only 1 controller and I want to grab the first 2 drives.

But on my T3-1/T4-1 & T3-4/T4-4’s, this isn’t going to be useful as I want to grab the first disk on each controller (slot 0 and 4).

This has lead me to writing a script to produce this for me.

Let me introduce disk_slots.sh which you can download here (disk_slots.sh)

With no Arguments, it outputs the disk slots, Controller, disk ID and Size

root@t44test # ./disk_slots.sh
Slot   Ctlr   DiskID                  Size    
0      0      c0t5000CCA02532D080d0   300.00GB
4      1      c0t5000CCA025317AD4d0   300.00GB

Useful,but to make this useful for scripting i.e. jumpstart

you can specify a slot number and it returns the disk device

root@t44test # ./disk_slots.sh 0
c0t5000CCA02517FBF4d0
root@t44test # ./disk_slots.sh 4
c0t5000CCA0251F05ACd0

Now, I will combine this with a derived jumpstart profile, which I will describe in my next posting.

BTW, while writing this I learned that bc is broken in a jumpstart environment and using upper/lower with tr seems to barf on prtconf output and a-z/A-Z notation worked reliably.

Updated 5/30/2012: Updated script to Support Solaris 11
Updated 9/18/2012: Updated to fix issues with Determining Platform on T4-1 and added Controller Number to output

Advertisements

4 responses to “Mapping Disk Device to Slot number on T3/T4 based Systems

  1. bradhudsonjr May 14, 2012 at 6:28 pm

    You only need the WWN for JumpStart installs. Solaris 11 can use a multitude of other methods in the manifest file including the “receptacle-name” from croinfo:

    # croinfo -A SYS -o receptacle-name,occupant-compdev
    R:receptacle-name c:occupant-compdev
    —————– ———————
    /SYS/SASBP/HDD0 c0t5000CCA0151CA3D4d0
    /SYS/SASBP/HDD1 c0t5000CCA0151AD16Cd0
    /SYS/SASBP/HDD2 c0t5000CCA0151C6D14d0
    /SYS/SASBP/HDD3 c0t5000CCA0151CA5B0d0
    #

  2. bradhudsonjr May 14, 2012 at 6:33 pm

    You only need the WWN for JumpStart (Solaris 10) installs. Solaris 11 can use a host of other methods including the receptacle-name in the manifest file, which is the easiest and can be seen via the ILOM as well on SPARC. Sample:

    OS output:
    # croinfo -A SYS -o receptacle-name,occupant-compdev
    R:receptacle-name c:occupant-compdev
    —————– ———————
    /SYS/SASBP/HDD0 c0t5000CCA0151CA3D4d0
    /SYS/SASBP/HDD1 c0t5000CCA0151AD16Cd0
    /SYS/SASBP/HDD2 c0t5000CCA0151C6D14d0
    /SYS/SASBP/HDD3 c0t5000CCA0151CA5B0d0
    #

    ILOM:
    -> ls /SYS/SASBP

    /SYS/SASBP
    Targets:
    HDD0
    HDD1
    HDD2
    HDD3
    DVD

  3. jflaster May 14, 2012 at 7:13 pm

    Thank you for the info. Solaris 11 is a huge improvement across the board for provisioning. AI definitely has a bit of a learning curve and a wealth of options compared to Jumpstart.

    I have a existing derived ai scripted setup using a single manifest for my existing x86 & T-/M-series, but haven’t updated and tested it on the T3/T4. I’ll look into using those methods as I do like to keep things simple, especially if I’m writing a script to work across aboard on all my systems.

  4. Heather Bayne May 16, 2012 at 4:10 pm

    Thank you. We were having all sorts of problems. Our T4-1 wouldn’t boot off a drive if it was in the second controller, and we were scratching our heads trying to parse prtconf clean from cdrom. I was able to get as far as identifying the controller, but this is super helpful and saved me a ton of work! Thanks again. Great work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: