====== Howto set a persistent / permanent device name (or change device name) ======
===== Example with network adapter =====
Template for are located in /lib/udev/rules.d/
Copy the right template corresponding to your wish in /etc/udev/rules.d/
==== Use the PCI bus identifier as reference to rename your adapter ====
# lspci
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
# ifconfig -a
ens192: flags=4163 mtu 1500
inet 172.11.1.1 netmask 255.255.255.0 broadcast 172.16.2.255
inet6 fe80::2d97:92df:16f7:e385 prefixlen 64 scopeid 0x20
ether 00:50:56:bc:4a:86 txqueuelen 1000 (Ethernet)
...
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
...
Copy the file /lib/udev/rules.d/60-net.rules to /etc/udev/rules.d/60-net.rules
Edit the file to interface:
SUBSYSTEM=="net", ACTION=="add", KERNELS=="0000:00:03.0", NAME=="eth0"
And restart the service, or better reboot
# systemctl restart systemd-udevd
Or
# systemctl reboot
Now the adapter name is **eth0**, you can reconfigure the IP address,...
# ifconfig -a
eth0: flags=4163 mtu 1500
inet6 fe80::2d97:92df:16f7:e385 prefixlen 64 scopeid 0x20
ether 00:50:56:bc:4a:86 txqueuelen 1000 (Ethernet)
...
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
...
And test the config:
# udevadm test /sys/class/net/eth0
==== Use the MAC address as reference to rename your adapter ====
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bc:4a:86", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
===== Example with IBM tape library =====
http://www-01.ibm.com/support/docview.wss?uid=swg21664258
To be sure that we can use a unique device name on multiple TSM server for a tape library, we can use the serial number:
First install IBM Atape drive (download from FixCentral)
Effective drives defined on linux
[root@rhtsmp01 dev]# cat /proc/scsi/IBMtape
lin_tape version: 3.0.3
lin_tape major number: 247
Attached Tape Devices:
Number model SN HBA SCSI FO Path
0 ULT3580-TD5 1068051xxx lpfc 1:0:0:0 NA
1 ULT3580-TD5 9168016xxx lpfc 1:0:1:0 NA
2 ULT3580-TD6 9068800xxx lpfc 1:0:2:0 NA
3 ULT3580-TD6 10WT005xxx lpfc 1:0:3:0 NA
4 ULT3580-TD6 10WT000xxx lpfc 1:0:4:0 NA
5 ULT3580-TD6 10WT000xxx lpfc 1:0:5:0 NA
6 ULT3580-TD3 1210070xxx lpfc 1:0:6:0 NA
7 ULT3580-TD3 1210082xxx lpfc 1:0:7:0 NA
8 ULT3580-TD5 1068055xxx lpfc 2:0:0:0 NA
9 ULT3580-TD6 9068800xxx lpfc 2:0:1:0 NA
10 ULT3580-TD6 10WT000xxx lpfc 2:0:2:0 NA
11 ULT3580-TD6 10WT005xxx lpfc 2:0:3:0 NA
12 ULT3580-TD6 10WT000xxx lpfc 2:0:4:0 NA
13 ULT3580-TD3 1210082xxx lpfc 2:0:5:0 NA
14 ULT3580-TD3 1210177xxx lpfc 2:0:6:0 NA
Effective library changer defined on linux
[root@rhtsmp01 dev]# cat /proc/scsi/IBMchanger
lin_tape version: 3.0.3
lin_tape major number: 247
Attached Changer Devices:
Number model SN HBA SCSI FO Path
0 3576-MTL 000001323333_LLA lpfc 1:0:0:1 NA
1 3576-MTL 000001321220_LLA lpfc 1:0:5:1 NA
2 3576-MTL 000001321220_LLA lpfc 2:0:2:1 NA
3 3576-MTL 000001301984_LLB lpfc 2:0:5:1 NA
4 3576-MTL 000001301984_LLB lpfc 2:0:6:1 NA
Assign alias to drives
[root@rhtsmp01 dev]# cat /etc/udev/rules.d/98-lin_tape.rules
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="10WT002226", SYMLINK="lin_tape/by-id/10WT002226_LTO6D1", MODE="0666"
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="10WT009976", SYMLINK="lin_tape/by-id/10WT009976_LTO6D3", MODE="0666"
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="9068802254", SYMLINK="lin_tape/by-id/9068802254_LTO6D2", MODE="0666"
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="10WT004428", SYMLINK="lin_tape/by-id/10WT004428_LTO6D4", MODE="0666"
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="1068055542", SYMLINK="lin_tape/by-id/1068055542_LTO5D1", MODE="0666"
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="9168016299", SYMLINK="lin_tape/by-id/9168016299_LTO5D2", MODE="0666"
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="1068055766", SYMLINK="lin_tape/by-id/1068055766_LTO5D3", MODE="0666"
KERNEL=="IBMtape*[!n]", ATTR{serial_num}=="1068052558", SYMLINK="lin_tape/by-id/1068052558_LTO5D4", MODE="0666"
KERNEL=="IBMchanger*",, ATTR{serial_num}=="000001323333_LLA", SYMLINK="lin_tape/by-id/00000132333_LLA_TS3310ROC", MODE="0666"
KERNEL=="IBMchanger*",, ATTR{serial_num}=="000001321220_LLA", SYMLINK="lin_tape/by-id/000001321220_LLA_TS3310ROOS", MODE="0666"
Scan SCSI bus (FC adapters)
[root@rhtsmp01 rc3.d]# ls /sys/class/scsi_host/host*/scan
/sys/class/scsi_host/host0/scan /sys/class/scsi_host/host3/scan
/sys/class/scsi_host/host1/scan /sys/class/scsi_host/host4/scan
/sys/class/scsi_host/host2/scan
[root@rhtsmp01 rc3.d]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@rhtsmp01 rc3.d]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@rhtsmp01 rc3.d]# echo "- - -" > /sys/class/scsi_host/host2/scan
[root@rhtsmp01 rc3.d]# echo "- - -" > /sys/class/scsi_host/host3/scan
[root@rhtsmp01 rc3.d]# echo "- - -" > /sys/class/scsi_host/host4/scan
Or
rescan-scsi-bus.sh
List SCSI devices
[root@rhtsmp01 rc3.d]# lsscsi
[0:0:0:0] enclosu IBM VSBPD12M1 6GSAS 03 -
[0:0:1:0] enclosu IBM VSBPD12M1 6GSAS 03 -
[0:0:2:0] cd/dvd TSSTcorp CDDVDW TS-L633B IB03 /dev/sr0
[0:3:0:0] no dev IBM 57D7001SISIOA 0150 -
[1:0:0:0] tape IBM ULT3580-TD5 G360 -
[1:0:0:1] mediumx IBM 3576-MTL 680G -
[1:0:1:0] tape IBM ULT3580-TD5 G360 -
[1:0:2:0] tape IBM ULT3580-TD6 G350 -
[1:0:3:0] tape IBM ULT3580-TD6 G350 -
[1:0:4:0] tape IBM ULT3580-TD6 G350 -
[1:0:5:0] tape IBM ULT3580-TD6 G350 -
[1:0:5:1] mediumx IBM 3576-MTL 670G -
[1:0:6:0] tape IBM ULT3580-TD3 93GP -
[1:0:7:0] tape IBM ULT3580-TD3 93GP -
[2:0:0:0] tape IBM ULT3580-TD5 G360 -
[2:0:1:0] tape IBM ULT3580-TD6 G350 -
[2:0:2:0] tape IBM ULT3580-TD6 G350 -
[2:0:2:1] mediumx IBM 3576-MTL 670G -
[2:0:3:0] tape IBM ULT3580-TD6 G350 -
[2:0:4:0] tape IBM ULT3580-TD6 G350 -
[2:0:5:0] tape IBM ULT3580-TD3 93GP -
[2:0:5:1] mediumx IBM 3576-MTL 640G -
[2:0:6:0] tape IBM ULT3580-TD3 93GP -
[2:0:6:1] mediumx IBM 3576-MTL 640G -
[3:0:0:0] disk IBM 2145 0000 /dev/sda
[3:0:1:0] disk IBM 2145 0000 /dev/sdb
[3:0:2:0] disk IBM 2145 0000 /dev/sdc
[3:0:2:1] disk IBM 2145 0000 /dev/sdd
On TSM, define the drive and the drive path using the device persistent name. For example :
DEFINE DRIVE LIBRARY_Name DRV_LTO6D1 SERial=AUTOD element=AUTOD Online=YES
DEFINE PATH SERVER_NAME DRV_LTO6D1 SRCT=server DESt=drive LIBRARY=LIBRARY_Name device=/dev/lin_tape/by-id/10WT002226_LTO6D1 online=yes