linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Statically nameing a SCSI device
Date: Sun, 12 Aug 2007 03:49:56 +0000	[thread overview]
Message-ID: <20070812034956.GA10085@kroah.com> (raw)
In-Reply-To: <1240.65.170.133.237.1186867534.squirrel@webmail.sysmatrix.net>

On Sat, Aug 11, 2007 at 04:25:34PM -0500, gerald.hotplug@sysmatrix.net wrote:
> I know this was discussed recently here:
> <http://sourceforge.net/mailarchive/forum.php?thread_nameÓd656c40708012110o29e111b4w707ee03afb0e71f2%40mail.gmail.com&forum_name=linux-hotplug-devel>
> 
> I wasn't on the list at the time so I'm starting a new thread.
> 
> I have a rather unique situation.
> 
> I have a machine with 20 drive bays. 16 SCSI-SCA and 4 SATA. The
> architecture does not know about the SATA controller until the Linux
> kernel takes over so they cannot be used as boot devices. They need to
> stay at the "end of the device tree".
> 
> I would like to give them persistent names of /dev/sdw, /dev/sdx,
> /dev/sdy, and /dev/sdz.
> 
> But, all of the programs that udev uses to get unique identifying
> information about drives to use in naming rules seem to require that you
> know the kernel name first.

That's because the kernel always names the device first, and than passes
that information off to udev.

> Why does nothing in udev seem to allow one to use standard SCSI
> host,channel,device,lun nomenclature to query a device?

You can do that just fine if you want to, just look at the device chain
for the block device, the information is in there.

> The 4 SATA bays will have drives in all of them long before I fill up 16
> SCA bays. But, every time I add and SCA drive to the primary controller
> all of the SATA drives have their kernel name shifted up one letter so I
> can't use the kernel name to query the device for its serial number.
> 
> These drives are for data storage only but they will probably be formatted
> using LVM so I can create one big mount point without having a symlink
> farm growing so I need to keep stable /dev/sd'x' names for LVM to keep
> track of them.
> 
> Anyone have any idea of what I can use to create a uniquely identifying
> rule for each of these drives so that I can assign static /dev/sd'x' NAMES
> to them at boot time even when the kernel name has changed?

Just look at what gets created for you in /dev/disk/  The information
there should help you.

> Or, can anyone point me to documentation of a clear way to do this in
> kernel space. Eg., to have the kernel always assign the same kernel name
> to a device in a certain range (sdw, sdx, sdy, sdz) based on it's SCSI
> loaction ID (4,0,0,0 -- 4,0,1,0 -- etc.)?
> 
> Thanks,
> 
> Gerald
> 
> P.S.
> 
> Wait a sec, I'm re-reading my message before posting and getting an idea
> but I have too little udev experience to implement it.
> 
> Can I write a set of rules in a 20-local.rules file that will run
> 
> scsi_id -g -s /block/sd'x'
> 
> for every value of 'x' looking for
> 
> "SATA     WDC WD2500YS-01     WD-WCANY1955037"
> 
> And then assigning NAME="sdw"

Yes, you can do just that.

good luck,

greg k-h

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  reply	other threads:[~2007-08-12  3:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-11 21:25 Statically nameing a SCSI device gerald.hotplug
2007-08-12  3:49 ` Greg KH [this message]
2007-08-12  5:50 ` Andrey Borzenkov
2007-08-12  8:16 ` gerald.hotplug
2007-08-12 12:24 ` Kay Sievers
2007-08-12 12:43 ` Andrey Borzenkov
2007-08-12 13:00 ` Kay Sievers
2007-08-12 15:46 ` Gerald V. Livingston II
2007-08-12 16:29 ` Kay Sievers
2007-08-12 16:58 ` Gerald V. Livingston II
2007-08-15 22:16 ` Gerald V. Livingston II

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=20070812034956.GA10085@kroah.com \
    --to=greg@kroah.com \
    --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).