From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Sun, 12 Aug 2007 03:49:56 +0000 Subject: Re: Statically nameing a SCSI device Message-Id: <20070812034956.GA10085@kroah.com> List-Id: References: <1240.65.170.133.237.1186867534.squirrel@webmail.sysmatrix.net> In-Reply-To: <1240.65.170.133.237.1186867534.squirrel@webmail.sysmatrix.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org On Sat, Aug 11, 2007 at 04:25:34PM -0500, gerald.hotplug@sysmatrix.net wrot= e: > I know this was discussed recently here: > >=20 > I wasn't on the list at the time so I'm starting a new thread. >=20 > I have a rather unique situation. >=20 > 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". >=20 > I would like to give them persistent names of /dev/sdw, /dev/sdx, > /dev/sdy, and /dev/sdz. >=20 > 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. >=20 > 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. >=20 > 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.)? >=20 > Thanks, >=20 > Gerald >=20 > P.S. >=20 > 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. >=20 > Can I write a set of rules in a 20-local.rules file that will run >=20 > scsi_id -g -s /block/sd'x' >=20 > for every value of 'x' looking for >=20 > "SATA WDC WD2500YS-01 WD-WCANY1955037" >=20 > And then assigning NAME=3D"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