Navigation

User login

You are here

Mastering udev on Netapp iSCSI LUNS

Past week I have been busy with writing an udev rule to create symbolic links to some iSCSI devices. The iSCSI targets are our Netapp filers.

Unfortunately it is not so easy to distinguish which device is which LUN (problem a) and how do create a nice symlink that survives reboots and rescans (problem b)

On the Netapp filer you can get all the information you need with:
vfasr11@fr1b*&gt; lun show -v
/vol/sysdisks2/testlun 10g (10737418240) (r/w, online, mapped)
Serial#: C4lsD4HHqmAf
Share: none
Space Reservation: enabled
Multiprotocol Type: linux
Maps: xen_dom0=1
In bold is the LUN ID for that LUN in the xen_dom0 igroup.

There are several ways to tackle that problem a:

Give your LUN different sizes. And look at the sizes. This isn't a 'good' to handle the problem.

As you can see, only with the Netapp San tools you can get the most relevant information: which devices matches which lun-pathname.

To solve problem b, it is necessary to write an udev rule that creates a symlink to the device filename. In Writing udev rules, external naming they use the PROGRAM keyword. An other way is to use the IMPORT{program} keyword. Or you can use the RUN keyword.

I first tried it with IMPORT{program}, use a little script that provided the relevant information in enviroment variables, but I always got an error that my device did not exist. When I debugged udev I saw that the device file name was always created after my program had run. Using the PROGRAM statement gave me the same problem.

In udev it is possible to name your udev rule so that get started lexicographically, but even renaming it to z99_my.rule didn't change the order. My script was always started before the device file name was created.

On the udev mailing list someone pointed out that I had to look at the multipath udev rules. That it contained some way to fix the ordering. Alas, it didn't give my any clues as I only saw IMPORT{program} and RUN statements.

Luckily someone else pointed out that only when using the RUN keyword you can be sure that your device filename will have been created. And indeed, when using RUN my script that was in my udev rule was called after the device was created.

Maybe you are wondering why my device has to be created before I can run my script? That is because Netapp's sanlun tool needs the device to be created. It can't work on the temporary device that most of the udev rules use.

My rule now looks like:
djlyj43j:/etc/ud/etc/udev/rules.d# cat z21_netapp_persistant.rules
SUBSYSTEM!="block", GOTO="no_volume_id"
DRIVERS=="vbd", GOTO="no_hardware_id"
KERNEL=="sd[!0-9]", RUN+="netappluns %k"
LABEL="no_volume_id"
My script is located in /lib/udev/netappluns. It takes the e.g. 'sdb' as input and creates th relevant links. But also removes the relevant links when the device is removed. See the script here. The downside of using RUN is that you have to manually maintain the links!

They want you to come to the salon on a regular basis so they tell you that you need to get a haircut every four to six weeks, but
it's just a way for them to make more money.
When too much pressure is put on the hair over time it can speed up the hair shedding process, resulting in the loss of hairs already
in the telogen phase. light of one wavelength, not of an entire
spectrum like a light bulb.

I have find the best stories on mastering udev netapp iscsi luns and content services. These are all needed to find http://topaussiewriters.com/ web articles and those web worm topics. Thank you so much to everyone for updating the following articles.