Sumit Gupta's Blog
Persistent bind solution, Creating consistent tape links across SAN
The famous "Persistent Bind" (aka Consistent Binding) issue: For a
very long time I was just told that the "tape links are not persistent".
I always replied "They dont change across reboots. Whats the exact problem ?" and everybody I asked, had a different definition of it.
Recently when I talked to a SUN support engineer for a specific account
and he explained me the exact steps which lead to this problem.
Problem Description
To simplify management of servers in SAN-based data-centers, the SAN
Foundation Software stack in the Solaris OS dynamically detects devices
in a SAN and builds associated /dev tree entries without the need to
edit configuration files. In most cases this greatly simplifies SAN
management however, for tape devices, some system administrators would
still like the ability to explicitly specify how /dev entries are
created and to insure the /dev entries are identical across multiple
servers on a SAN. The procedure given below describes how administrators can
specify this tape binding in the Solaris OS while retaining the benefits
of automatic discovery and addition for disk-based devices.
Background
The /dev/rmt directory contains links to physical devices under /devices
for tape devices. Each tape LUN seen by the system is represented by 24
minor nodes in the form of /dev/rmt/<N>, /dev/rmt/<N>b, /dev/rmt/<N>bn
where N can be any number starting from 0. This number is picked up by
devfsadm during enumeration of new devices. Every new tape LUN found by
devfsadm gets the next available number in /dev/rmt.
Since the /dev/rmt name is dependent upon the order in which devices
appear in the device tree, it changes from host to host i.e. For a given
tape drive seen by two or more different hosts, the /dev/rmt link can be
different on each of these hosts. This breaks the most common usage of
Netbackup (SSO option). Also if the drive is replaced the links
change unless the vendor provides a way to retain the PWWN of the drive.
Approach
The /etc/devlink.tab file is called the default device table file. It
specifies rules that devfsadm uses to create links in the /dev directory.
See 'man devlinks' for more information. Currently there are no entries
in this file for tapes because devfsadm already knows how to create links
for tape drives, but rules can be added that will take modify the default
behavior for creating tape links.
The following is a sample entry for tape in devlink.tab:
type=ddi_byte:tape;addr=w<PWWN>,<LUN>; rmt/<rmt #>\M0
the administrator should change the rmt # to whatever /dev/rmt/<N> is required. Then change the Port World-Wide Name (PWWN) and Logical Unit Number (LUN) to match the desired tape device. This information can be obtained by doing a ls -l on the existing /dev/rmt/ link as shown below.
# ls -l /dev/rmt/4 lrwxrwxrwx 1 root root 69 Oct 6 14:57 /dev/rmt/4 -> ../../devices/pci@1f,700000/SUNW,qlc@2/fp@0,0/st@w5005076300617717,0: #
If, for example, the administrator wants the /dev/rmt/ number to be 40, the entry in /etc/devlink.tab will look like:
type=ddi_byte:tape;addr=w5005076300617717,0; rmt/40\M0
The administrator can then add this line to the devlink file on every Solaris server on the SAN that uses this drive so that it always appears as minor node 40.
Notes
1. For any tape drives visible to Solaris but not specified in the devlink file, devfsadm will automatically assign minor node numbers starting from zero. These will conflict with any low numbers assigned by the administrator in /etc/devlink.tab so be sure to assign numbers high enough to avoid conflicts.
2. This approach can easily lead to duplicate links in /dev/rmt. That is because any tapes discovered before entries are specified in /etc/devlink.tab will have automatically-created links. Then when entries are added and devfsadm is run, the original links will remain resulting in duplicate links. To remove the original links in /dev/rmt, run 'rm /dev/rmt/*' before running devfsadm as described in the specific steps below.
3. This approach cannot be used with multi-ported tape drives that are attached to multiple HBA ports. If one does have multiple HBA ports attached to the same tape LUN then the system now thinks that there are two tape drives instead of one the one that appears last in prtconf output will get the link generated by the /etc/devlink.tab.
Specific Configuration Steps
1. Create the entries in /etc/devlink.tab as shown above. If devfsadm has previously discovered the devices, the device address can be obtained by doing a ls -l on the existing link. Take care to assign /dev/rmt/<N> numbers, to avoid conflicts with any automatically configured devices as described above.
2. Remove existing links from /dev/rmt by running 'rm /dev/rmt/*'
3. Run devfsadm. This will create new links as per the entries in /etc/devlink.tab in addition to automatically creating links for any unspecified devices.
Posted at 11:32AM Nov 01, 2005 by hbainsights in General | Comments[12]
Posted by Cecil Jacobs on November 02, 2005 at 08:52 AM PST #
Posted by Joost Mulders on November 02, 2005 at 12:21 PM PST #
type=ddi_byte:tape;addr=w<PWWN>,<LUN>;[tab]rmt/<rmt #>\M0
or devfsadm will complain.
Posted by Chris matta on June 07, 2006 at 07:04 AM PDT #
devfsadm -c tape
Running devfsadm without '-c' works fine.
I'm running Solaris 9 with SFS patches. Is that normal?
Posted by Steve Jones on January 23, 2007 at 07:56 AM PST #
Posted by Christian on August 02, 2007 at 07:03 AM PDT #
Or perhaps the Sun document was based on this blog entry?
Posted by Dave on August 27, 2007 at 12:52 PM PDT #
Just look at the dates that the things were posted. :)
Posted by Joe Win on January 04, 2008 at 11:47 AM PST #
[...]Tape Drives[...]
Posted by battery on June 19, 2008 at 06:28 PM PDT #
Persistent bind solution is very lovely and useful.
Posted by Shazia on December 17, 2008 at 03:29 AM PST #
@Joost: only if you don't ever move the devices to a different controller!
@Steve Jones: thanks for that observation, I just had the same problem with devfsadm -c tape and the devlink.tab file.
@Chris Matta: devfsadm on sol10u6 also complains if you have a trailing semicolon at the end of the first field, i.e. the semicolon straight after the LUN and before the <TAB> char.
Also be careful of spaces hiding before to the TAB chars - the LUN will be taken to have a space at the end of it, and so will not match any /devices entries!
Posted by Jason Ozolins on January 06, 2009 at 06:02 AM PST #
Information of this post is very lovely and good.
Posted by pakistanjobs.pk on May 09, 2009 at 04:37 AM PDT #
@Joost: Thank you! I always thought that was just a space and it was giving me problems.
Also, to continue with the clarification:
type=ddi_byte:tape;addr=w<PWWN>,<LUN>;[tab]rmt/<rmt #>\M[Zero]
The first time I read through the document I had a capital o after the M and not a zero.
Thanks!
Posted by Cory Matteucci on August 24, 2009 at 04:32 PM PDT #