http://blogs.netapp.com/databases/2009/06/udev-rules-to-enable-device-name-persistence.html
Hi All,
This is neto from Brazil
How are you?
Linux doesn't guarantee a persistence device name for SCSI devices. This can cause all kinds of fun with your LUNS because the device name associated with LUNS presented from the NetApp can get shuffled around.
A solution is: Setup UDEV Rules to enable device name persistence.
Note: NOT Needed for Data Disks when ASMLib is used. In this case only setup device persistence for the OCR and VOTE disks.
1. White List the NetApp LUNS (devices)
- add a line to /etc/scsi_id.config
vendor="NETAPP", model=LUN, options=-g
- - This allows UDEV to obtain the UUID from LUNS
- - Without this entry the "-g" option will always be needed on the scsi_id command to get any results
- - The Vendor and Model information can be obtained by this:
scsi_id -gxs /block/sdg
ID_VENDOR=NETAPP <--Here
ID_MODEL=LUN <--And Here
ID_REVISION=0.2
ID_SERIAL=360a980004334616e52344746596b2d67
ID_TYPE=disk
ID_BUS=scsi
Obtain list of LUNS from the NetApp Controllers
- sanlun lun show all
sanlun lun show all
filer: lun-pathname device filename adapter protocol lun size lun state
tng1: /vol/css1/ocr1 /dev/sdg host9 iSCSI 280m (293601280) GOOD
tng2: /vol/css2/ocr2 /dev/sdb host8 iSCSI 280m (293601280) GOOD
tng1: /vol/css1/vote1 /dev/sdh host9 iSCSI 280m (293601280) GOOD
tng2: /vol/css2/vote2 /dev/sdc host8 iSCSI 280m (293601280) GOOD
tng1: /vol/css1/vote3 /dev/sdi host9 iSCSI 280m (293601280) GOOD
.
.
.
3. Get the Serial number for each SCSI Device (LUN)
- scsi_id -p 0x83 -s /block/sdg
- scsi_id -p 0x83 -s /block/sdb
- scsi_id -p 0x83 -s /block/sdh
- scsi_id -p 0x83 -s /block/sdc
- scsi_id -p 0x83 -s /block/sdi
- Sample Output:
scsi_id -s /block/sdi
360a9800043346161613447454776694c
4. Create a New UDEV rules file to statically name the SCSI Devices
- cd /etc/udev/rules.d
- vi 99-static-scsi-names.rules
- NOTE: This example includes setting ownership and permissions for Oracle RAC Clusterware Disks
#----------------------------
#BEGIN: OCR DISKS
#----------------------------
#css1/ocr
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="360a98000433461616134474541327154", NAME="sdOCR1%n", OWNER="root", GROUP="oinstall", MODE="0640"
#css2/ocr
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="360a980004334616e5234474541572f32", NAME="sdOCR2%n", OWNER="root", GROUP="oinstall", MODE="0640"
#----------------------------
#BEGIN: VOTE DISKS
#----------------------------
#css1/vote
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="360a980004334616161344745416b6542", NAME="sdVOTE1%n", OWNER="oracle", GROUP="oinstall", MODE="0640"
#css2/vote
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="360a980004334616e52344745416e4332", NAME="sdVOTE2%n", OWNER="oracle", GROUP="oinstall", MODE="0640"
#fra1/vote
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="360a98000433461
61613447454776694c", NAME="sdVOTE3%n", OWNER="oracle", GROUP="oinstall", MODE="0640
"
5. Execute the new rules file
- udevcontrol reload_rules
- start_udev
- OR
- reboot
Thank you very much my friend Allan Wilson and Lou Lydiksen.
All the best
neto
NetApp - My reason to live!