If you have a lot of tape drives connected to your host/server, sometimes its not easy to know the tape drives order between tape library and drive order on host.
Lets say, all tape drive order on tape library and host are starting from 0 (zero).You try to mount cartridge to tape drive number 6 on tape library using the utility (example SL Console or move command). After mounting succeeded, you may guess that the cartridges is mounted to drive order number 6 also on your host/server. You run the command “mt -f /dev/rmt/6cbn status” to check the result, but guess what? the cartridges is not in there..
This is because, cbn number is picked automatically by devfsadm during enumeration of new devices. Every new tape logical unit number (LUN) found by devfsadm gets the next available number in “/dev/rmt”. So, cbn number order its not same with drive number order on tape library.
Since the /dev/rmt name depends on the order in which devices appear in the device tree, it changes from host to host. For a given tape drive that is seen by two or more different hosts, the /dev/rmt link can be different on each of these hosts. Also, if the drive is replaced the links change unless the vendor provides a way to retain the port World-Wide Name (PWWN) of the drive.
So, now what we need to do is just to configure persistent binding for all tape devices. on Solaris, we only need to edit “/etc/devlink.tab” file. First of all, list all tape drives on current configuration:
Example:
# ls -ltr /dev/rmt/*cbn
lrwxrwxrwx 1 root root 75 Mar 1 15:50 /dev/rmt/3cbn -> ../../devices/pci@8,600000/SUNW,emlxs@1,1/fp@0,0/st@w500108f00056a81c,0:cbn
lrwxrwxrwx 1 root root 75 Mar 1 15:50 /dev/rmt/2cbn -> ../../devices/pci@8,600000/SUNW,emlxs@1,1/fp@0,0/st@w500108f00056a81b,0:cbn
lrwxrwxrwx 1 root root 75 Mar 1 15:50 /dev/rmt/1cbn -> ../../devices/pci@8,600000/SUNW,emlxs@1,1/fp@0,0/st@w500108f00056a81a,0:cbn
lrwxrwxrwx 1 root root 75 Mar 1 15:50 /dev/rmt/0cbn -> ../../devices/pci@8,600000/SUNW,emlxs@1,1/fp@0,0/st@w500108f00056a81d,0:cbn
So, there are 4 tape drives, the current config is like this:
drive 0cbn: w500108f00056a81d,0
drive 1cbn: w500108f00056a81a,0
drive 2cbn: w500108f00056a81b,0
drive 3cbn: w500108f00056a81c,0
If you check on tape library, the drive order is like this:
drive o: w500108f00056a81a,0
drive 1: w500108f00056a81b,0
drive 2: w500108f00056a81c,0
drive 3: w500108f00056a81d,0
Now, ho to match drives order between tape library and your host? okay, here we go:
1. Edit “/etc/devlink.tab” file.
2. add these line:
type=ddi_byte:tape;addr=w500108f00056a81a,0; rmt/0\M0
type=ddi_byte:tape;addr=w500108f00056a81b,0; rmt/1\M0
type=ddi_byte:tape;addr=w500108f00056a81c,0; rmt/2\M0
type=ddi_byte:tape;addr=w500108f00056a81d,0; rmt/3\M0
3. Remove existing links from /dev/rmt by running the rm /dev/rmt/* command.
4. run “devfsadm” command. run “reboot — -r” if needed.
5. Finish,
See the result by manualy mounting cartridges and check with “mt -f /dev/rmt/Xcbn status” command.
Type “man devlinks” for more information..
From my experience, only emulex card will require this.