linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev questions
Date: Thu, 21 May 2009 07:46:53 +0000	[thread overview]
Message-ID: <4A1506ED.4020101@tuffmail.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.60.0507171252510.21434@pc1lin.fred.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

  parent reply	other threads:[~2009-05-21  7:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-17 17:24 udev questions F. Heitkamp
2005-07-17 18:49 ` Greg KH
2009-05-21  7:46 ` Alan Jenkins [this message]
2009-05-21 10:21 ` Alan Jenkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A1506ED.4020101@tuffmail.co.uk \
    --to=alan-jenkins@tuffmail.co.uk \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).