Populating /dev/sg when Leadville drivers are in use

For the past day and a half, I have been trying to create device entries for several STK 9940B drives in the /dev/sg directory on a Solaris 10 server that is using the emlx driver. This should be straight forward, since Netbackup provides the sg.build shell script to assist with populating the sg.conf and devlink.tab files. Due to some issues with the way the sg.build script parses the output from luxadm, the script isn’t able to locate the WWPN of the emlx controlled HBAs in our servers. Once I found the problem, I was able to get things working by hand editing the results from the sg.build prior to updating the system files. Below is an overview of what I did, which will hopefully assist others who are encountering this problem.

To get your Solaris 10 server to properly populate /dev/rmt/* and /dev/sg/* with your tape devices, you will first need to locate the WWPN of each tape drive that you want your server to use. This information can be retrieved two ways. The first way is with the fcinfo “remote-port” option:

$ fcinfo remote-port -slp 10000000c92a9043

Remote Port WWN: 500104f0005f029d Active FC4 Types: SCSI SCSI Target: yes Node WWN: 500104f0005f027c Link Error Statistics: Link Failure Count: 0 Loss of Sync Count: 0 Loss of Signal Count: 0 Primitive Seq Protocol Error Count: 0 Invalid Tx Word Count: 21 Invalid CRC Count: 0 LUN: 0 Vendor: STK Product: T9940B OS Device Name: /dev/rmt/7n

This information can also be retrieved by first running luxadm to get the physical device paths for each HBA:

$ luxadm -e port

/devices/pci@8,600000/SUNW,qlc@2/fp@0,0:devctl CONNECTED /devices/pci@8,700000/lpfc@4/fp@0,0:devctl CONNECTED /devices/pci@8,700000/lpfc@5/fp@0,0:devctl CONNECTED /devices/pci@9,600000/lpfc@1/fp@0,0:devctl CONNECTED /devices/pci@9,600000/lpfc@2/fp@0,0:devctl CONNECTED

After you retrieve the device paths, you can run luxadm with the “-e” and “dump_map” options to display the targets and LUNs that are present on each path:

$ luxadm -e dump_map /devices/pci@8,700000/lpfc@4/fp@0,0:devctl

Pos Port_ID Hard_Addr Port WWN Node WWN Type 0 21855 55 500104f0005f027c 500104f0005f027b 0x1 (Tape device) 1 21955 55 500104f0005f0285 500104f0005f0284 0x1 (Tape device) 2 21b55 55 500104f0005f026d 500104f0005f026c 0x1 (Tape device) 3 21a00 0 10000000c936560c 20000000c936560c 0x1f (Unknown Type,Host Bus Adap ter)

Once you identify the WWPNs associated with your tape devices, you will need to add one entry per tape drive to the /kernel/drv/sg.conf configuration file. Here are two sample sg.conf entries:

name=“sg” parent=“fp” target=0 lun=0 fc-port-wwn=“500104f0005f027c”; name=“sg” parent=“fp” target=0 lun=0 fc-port-wwn=“500104f0005f0285”;

After the sg.conf file is updated, you will need to add one entry per tape drive to the /etc/devlink.tab file. These entries will then be used by devfsadmd to populate the /dev/sg directory with the pertinent symbolic links. Here are two sample entries from my devlink.tab file:

type=ddi_pseudo;name=sg;addr=w500104f0005f027c,0; sg/cN0tA1l0 type=ddi_pseudo;name=sg;addr=w500104f0005f0285,0; sg/cN0tA1l0

In addition to defining the device links for the /dev/sg directory in the devlink.tab file, you can also add one or more entries to bind your tape drives to specific /dev/rmt/[0-9]+ numbers. Here are two sample entries that map tape drives to specific /dev/rmt/ entries:

type=ddi_byte:tape;addr=w500104f0005f027c,0; rmt/0M0 type=ddi_byte:tape;addr=w500104f0005f0285,0; rmt/1M0

While I can’t easily represent tabs in my blog post, you should note that there is a tab between the “;” and the “sg” and “rmt” strings. After you update and verify all of the configuration files listed above, you should clear out /dev/rmt/* and /dev/sg/* to ensure that the device entries are created cleanly (if you don’t clean out the old entries, you will get new entries tacked on to the old ones):

$ rm -f /dev/rmt/

$ rm -f /dev/sg/

If you removed the device entries, you will then need to perform a reconfiguration reboot to rebuild your device links (for some reason, the /dev/sg entries don’t get populated until a reconfiguration reboot occurs). When the box comes back up, you should have a nice clean set of links in /dev/rmt/* and /dev/sg/*:

$ ls -la /dev/rmt/ | head -1

lrwxrwxrwx 1 root root 64 Jun 25 16:40 /dev/rmt/0 -> ../../devices/pci@8,700000/lpfc@4/fp@0,0/st@w500104f0005f027c,0:

$ ls -la /dev/sg/ | head -1

lrwxrwxrwx 1 root root 67 Jun 25 16:44 /dev/sg/c0tw500104f0005f026dl0 -> ../../devices/pci@8,700000/lpfc@4/fp@0,0/sg@w500104f0005f026d,0:raw

Now that my tape drives are showing up correctly, it’s time to start doing some backups!

This article was posted by Matty on 2007-06-27 12:38:00 -0400 EDT