Solved

udev rules

Posted on 2014-01-19
5
392 Views
Last Modified: 2014-02-25
I am trying to write a udev rules for iSCSI storage.  I wrote the following rules in node1 and I am accessing iSCSI storage from node4. What I don't understand is why I am getting all tty's are also applied to this rules.

[root@node1 rules.d]# vim 60-persistent-storage.rules
ACTION=="add",
KERNEL=="/dev/sd*",
SUBSYSTEM=="block",
SUBSYSTEMS=="scsi",
ATTRS{model}=="VIRTUAL-DISK",
SYMLINK+="SAN%n",
MODE="0644"


[root@node1 ~]# ls -l /dev/SAN
SAN    SAN11  SAN15  SAN19  SAN22  SAN26  SAN3   SAN33  SAN37  SAN40  SAN44  SAN48  SAN51  SAN55  SAN59  SAN62  SAN9
SAN0   SAN12  SAN16  SAN2   SAN23  SAN27  SAN30  SAN34  SAN38  SAN41  SAN45  SAN49  SAN52  SAN56  SAN6   SAN63
SAN1   SAN13  SAN17  SAN20  SAN24  SAN28  SAN31  SAN35  SAN39  SAN42  SAN46  SAN5   SAN53  SAN57  SAN60  SAN7
SAN10  SAN14  SAN18  SAN21  SAN25  SAN29  SAN32  SAN36  SAN4   SAN43  SAN47  SAN50  SAN54  SAN58  SAN61  SAN8


[root@node1 ~]# multipath -ll
SAN (1IET     00010001) dm-2 ,
size=4.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| `- #:#:#:# -   #:#  active faulty running
`-+- policy='round-robin 0' prio=0 status=enabled
  `- #:#:#:# -   #:#  active faulty running


I am only getting /dev/sdb and /dev/sdc and I am using multipath to access these disks.


I am not sure why rules applied to other devices as well according to above udev rules definition.
0
Comment
Question by:ittechlab
  • 3
5 Comments
 
LVL 40

Expert Comment

by:noci
ID: 39794451
Are these on one line or on multiple lines...
If not on one line then each item is check on it's own.

So the SUBSYSTEM=="block"will fire on it's own, without further action on blockdevices.
so will the assignment rule 'SYMLINK+="SAN%n"', . And that will effectively count all devices wether it is a tty , block or what ever.
Worse all devices will probably end up in mode [cd]rw-r--r--
which might not be what you want either.

This is what you need (all items on one line):

ACTION=="add", KERNEL=="/dev/sd*", SUBSYSTEM=="block", SUBSYSTEMS=="scsi", ATTRS{model}=="VIRTUAL-DISK", SYMLINK+="SAN%n", MODE="0644"

Open in new window

0
 
LVL 40

Accepted Solution

by:
noci earned 500 total points
ID: 39794466
if you want a setup looking like yours:

ACTION!="add", GOTO="san_name_slot_end"
SUBSYSTEM!="block", GOTO="san_name_slot_end"
SUBSYSTEMS!="scsi", GOTO="san_name_slot_end"
ATTRS{model}=="VIRTUAL-DISK", GOTO="san_name_slot_end"

KERNEL=="/dev/sd*",   SYMLINK+="SAN%n", MODE="0644"

LABEL="san_name_slot_end"

Open in new window

0
 
LVL 13

Expert Comment

by:Sandy
ID: 39795984
I am not sure but i achieved it by using filters under /etc/multipath.conf
0
 
LVL 40

Expert Comment

by:noci
ID: 39796589
nope,

this needs to be in /etc/udev/rules.d.....
0
 

Author Comment

by:ittechlab
ID: 39820920
Let me try this method.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cannot rename datastore 3 93
Samba 4, Users Permission, 5 62
combine Mutt command with a select statement to distribute file in Linux 2 48
CentOS 7 wireless 2 25
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question