Fork me on GitHub

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*> 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.
  • Look at the LUN IDs with (e.g.) 'scsiadd -s'. That will give you:
    Host: scsi1 Channel: 00 Id: 00 Lun: 01
    Vendor: NETAPP Model: LUN Rev: 0.
    Type: Direct-Access ANSI SCSI revision: 04
    In bold is the LUN ID.
  • Use 'sginfo -s /dev/device' to get the serial number of the LUN. Match that with the information on the filer.
  • Through the Netapp San tools, that are proprietary :
    clyj43j:/xen# sanlun lun show all
    filer: lun-pathname device filename adapter protocol lun size lun state
    vfasr11: /vol/sysdisks2/testlun2 /dev/sdd host1 iSCSI 10g (10737418240) GOOD
    vfasr11: /vol/sysdisks2/testlun /dev/sdc host1 iSCSI 10g (10737418240) GOOD
    Udev scriptvfasr11: /vol/sysdisks2/vliruos /dev/sdb host1 iSCSI 75g (80530636800) GOOD

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"
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!


I delight in, lead to I discovered just what I used to be taking a look for.
You have ended my four day lengthy hunt! God Bless you man.
Have a great day. Bye

High Protein Low Carb Diet

<a href=""></a>Кому Варвары, а мне штаны порвали.<a href=""></a>

За неимением алтына отвечает полтина.<a href=""></a>

<a href=""></a>По весне и припев.<a href=""></a>

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.

У старого жена молода - беда не мала.<a href=""></a>

<a href=""></a>Плач вдовца до крыльца.<a href=""></a>

С чем был, с тем и остался.<a href=""></a>

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

We always hope to give the best impression of an excellent moving experience.

We continue to establish a good and strong relationship with other clients.

You will enjoy a secure and protected moving experience from one place to another.

You can also buy all flavors cakes from here with free home delivery.

Occasions Made Special with Online Cake Delivery at Midnight.

Enjoy the best cakes delivery in the comfort of your home.

They also understand the meaning of the story, some of them even want to cry because the story is so touching.<a href="">assignmentmost</a>

I don't have much time, but I'd love to see your writing and writing services.

wow,,,this post is probably where I got the most useful information for my research.

They also understand the meaning of the story, some of them even want to cry because the story is so touching.

very nice

Add new comment