RE: More Elegant udev rules

"Greg Stevenson" <[email protected]> Wed, 23 Nov 2011 09:18:37 +1300
Newsgroups gmane.org.user-groups.linux.new-zealand.general
Message-ID <[email protected]>
Thanks Volker

Udevadm isn't part of xenserver distribution but udevinfo is. I guess that
is the important utility to determine what combination of variables will
most uniquely define the devices I want to work with.

I guess I'm after some combination that uniquely defines hard drives no
matter if they are SATA, PATA or pure SCSI with no concern for manufacturer
or model.

I'm picking something like KERNEL=="[h,s]d[a-c]" within the rule would go
some way to achieving what I'm after given that in this instance the system
resides on dev/sdd. 
Unfortunately that won't always be the case, and in a big system, many more
drives would be involved. I guess without the udev rules knowing where the
system resides there isn't a way of achieving this programmatically.

I would have loved your way of reloading the udev rules below to have worked
on xenserver but unfortunately I continue to have to reboot each time to
check the result of my changes.

Thanks for your help.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Volker Kuhlmann
Sent: Wednesday, 23 November 2011 12:17 a.m.
To: NZLUG Mailing List
Subject: Re: [nzlug] More Elegant udev rules

On Tue 22 Nov 2011 09:57:01 NZDT +1300, [email protected] wrote:

I recently needed some rules to create constant names in /dev specific to
particular FTDI USB/RS232 adapters. Your problem isn't quite the same but
probably needs the same solution.

The website I noted is this one:

http://answers.ros.org/question/65/how-can-i-get-a-unique-device-path-for-my

The udev manual is also handy. Points I noted in particular:

# *) There have been some changes. Some websites with descriptions and
howtos # are out-of-date and should be ignored.
# *) You can't change the kernel-assigned device name (other than by
changing # the kernel driver). You can only put a symlink, with the symlink
name # remaining constant and its target adjusted to the same hardware
piece.
# *) The device information is in a tree structure. Use udevadm. You can
match # to any node, but only to one(!) node. Messing that up results in a
non-match.
# *) I'm unsure whether long lines can be broken.

After changes run /etc/init.d/boot.udev restart Contrary to specified
behaviour reload didn't work reliably. Don't use stop and start.

udevadm is very handy to find the attributes you can use to match on.
Pay attention to the 1-node-only restriction or you will be sorry (read it
won't work, and it fails silently).

Turning write cache off on drives related to your new rules must be possible
through udev's action mechanism but I don'tknow the details of that.

HTH,

Volker

-- 
Volker Kuhlmann			is list0570 with the domain in header.
http://volker.dnsalias.net/	Please do not CC list postings to me.

_______________________________________________
NZLUG mailing list [email protected]
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug


_______________________________________________
NZLUG mailing list [email protected]
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug