From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Jenkins Date: Thu, 21 May 2009 07:46:53 +0000 Subject: Re: udev questions Message-Id: <4A1506ED.4020101@tuffmail.co.uk> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org David A. Roth wrote: > Hello Alan. > > I hope I have the right Alan Jenkins. I've seen your name while > Googling regarding udev. If you aren't the right person, please > forgive the error. > Well, you're not very specific about who you're looking for :-). I'm not the maintainer, if that's what you mean. You certainly have the wrong email address. I've CC'd linux-hotplug, which is the mailing list for Udev. > I have some udev questions and was wondering if you could shed any > light on the problems I'm having. Here is a posting of mine to the > CentOS forum concerning udev, udevinfo and udevtest. > > Thanks in advance, > > David A. Roth > davidalanroth@gmail.com > > Background: > > I have two external USB drives (Maxtor and LaCie), and I want them to > be assigned the same device at boot. /dev/sda for the Maxtor and > /dev/sdb for the LaCie. > > With a default rules installation of CentOS 5.3 the LaCie gets > assigned /dev/sda and the Maxtor /dev/sdb, which is the reverse order > of what I want. > That sounds like a really bad idea. > So it was suggested to me that I look into udev and write some rules. > I looked at two web pages for help with udev being: > > http://www.axllent.org/docs/data_storage/udev_and_external_devices > http://reactivated.net/writing_udev_rules.html > > I added the file 10-local.rules to /etc/udev/rules.d with these two lines: > > KERNEL="sd*",SYSFS{manufacturer}="Maxtor",NAME:="sda%n",SYMLINK+="usbmaxtor%n" > KERNEL="sd*",SYSFS{manufacturer}="LaCie",NAME:="sdb%n",SYMLINK+="usblacie%n" > > After booting, a 'df' shows that sda and /dev/usbmaxtor is indeed > assigned to the Maxtor. > > Problem: > > While the 'df' shows that the sda is assigned to the Maxtor > (/dev/usbmaxtor), udevinfo -a -p /sys/block/sda indicated that sda is > the LaCie drive. When doing dmesg, it has a remark that fsck should be > run on sdb3, but sdb only has one partition of sdb1. It's the Maxtor > which has sda3. > > Questions: > > Is the problem here with my rules statement above? If so, what do I > need to change? > There's no way change the name printed in kernel messages (dmesg) or under /sys. Udev only controls the name in /dev. (The exception is networking devices, which don't appear in /dev; I think they can have their kernel names changed). I hope that clears things up. If you only use the links, it should be fine. Btw, if you don't mind long link names, you may find udev already creates useful links under /dev/disk/by-id/. > I constructed the above from examples, but wasn't able to find > documentation that goes into detail. For example, what is the > different between NAME:= vs. NAME= ? > I think you're right that udev isn't comprehensively documented. But I this particular one is covered in the manual page ("man udev"). ":=" assignment is final, and cannot be overridden by an assignment in a subsequent rule. Alan