Persistent device names for fc luns

From Linux on Power wiki

Jump to: navigation, search

Contents

The Problem

We have high available dual VIO server configuration, each vio providing three virtual disks to the client. Two of them are virtualized LUNs in SAN. All three disks are mapped to the same virtual scsi adapter (which is wrong by design and actually caused the problem with device naming). Every time a new disk is added at VIO1 and mapped to the same SCSI adapter the disks provided by VIO2 are renamed (/dev/sdd becomes /dev/sde and so on). Assuming we can not change the design in HMC and VIO and provide only one virtual disk per virtual adapter, what can be done to keep the names persisten no matter how many new LUNs are added and mapped to the virtual scsi controller?

Approaches to a Problem

Labels

Mounting by label could be a solution, it does not works in our case, because we are using disks to create nested multipath devices with no file system. As far as I know labels only work for formatted disks or partitions

scsidev

Scsidev command looks great and would do exactly what we want, unfortunately it is not provided by Red Hat AS4 (it is in SUSE SLES9). As we are using Red Hat in this case we want to keep the system in "supported" state

/dev/disk/by-path

This works also for SUSE SLES9 only, there you have devices created by-id and by-path. by-id will not work for virtual disks provided by VIO, becaus scsi_id command does not works on them.

udev rules

I found nice Red Hat document describing how to resolve the problem with udev (which is the most proper way I think) but unfortunately it also uses scsi_id command which does not work on virtual disks provided by VIO.

see http://kbase.redhat.com/faq/FAQ_85_8082.shtm

copying device_by_name scripts from SUSE

I copied /sbin/udev.get_persistent_device_name.sh and /sbin/udev.get_uniqudev.get_unique_hardware_path.sh to a Red Hat system, had to change the shell path to /bin/sh and add a udev-rule in /etc/udev/rules.d

[root@op720-1-client2 ~]# cat /etc/udev/rules.d/20-names.rules

KERNEL="sd*", BUS="scsi", PROGRAM="/sbin/udev.get_persistent_device_name.sh", NAME="%k" SYMLINK="%c{1+}"
#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k" SYMLINK="disk/by-name/%c"

this worked, after running /sbin/start_udev command I have devices created by path:

[root@op720-1-client2 ~]# ls /dev/disk/by-path/
pci-target0:0:1-scsi-0:0:0:1:0    pci-target1:0:1-scsi-0:1:0:1:0
pci-target0:0:1-scsi-0:0:0:1:0p1  pci-target1:0:1-scsi-0:1:0:1:0p1
pci-target0:0:1-scsi-0:0:0:1:0p2  pci-target1:0:1-scsi-0:1:0:1:0p2
pci-target0:0:1-scsi-0:0:0:1:0p3  pci-target1:0:1-scsi-0:1:0:1:0p3
Personal tools