Statically nameing a SCSI device
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. Why does nothing in udev seem to allow one to use standard SCSI host,channel,device,lun nomenclature to query a device?
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?
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"
??
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 12 lines · On Sat, Aug 11, 2007 at 04:25:34PM -0500, [email protected] 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".
Quoted 6 lines
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.
Quoted 2 lines
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.
Quoted 5 lines
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.
Quoted 8 lines
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.
Quoted 16 lines
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
Quoted 7 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 5 lines · On Sunday 12 August 2007, [email protected] wrote:
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.
what makes you believe so?
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 11 lines · On Sunday 12 August 2007, [email protected] wrote:
Quoted 6 lines
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.what makes you believe so?
Nothing at the moment. In setting up this "play system" (personal server for mail, web, and multimedia) I suddenly find myself reading man pages and tutorials for a lot more subsystems than my brain apparently has the capacity to handle at one time.
Ive mixed up what requires which more than once in the last few days.
Now, that being said, it will be a lot easier for *ME* if I always know exactly where the SATA drives are located in the plain-old /dev tree and if I can call them /dev/sdw or /dev/sdz rather than /dev/disk/by-id/ata-WDC_WD2500YS-01S-WD-WCANY1955037
I added this to my local.rules and udevtest says it works great for the first drive I already have installed:
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", NAME="sdw"
As I add the other 3 drives I just need to add lines to identify their serial numbers and set them at sdx, sdy, and sdz.
Thanks,
Gerald
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 24 lines · On 8/12/07, [email protected] <[email protected]> wrote:
Quoted 8 lines · On Sunday 12 August 2007, [email protected] wrote:
Quoted 5 lines
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.what makes you believe so?
Nothing at the moment. In setting up this "play system" (personal server for mail, web, and multimedia) I suddenly find myself reading man pages and tutorials for a lot more subsystems than my brain apparently has the capacity to handle at one time.
Ive mixed up what requires which more than once in the last few days.
Now, that being said, it will be a lot easier for *ME* if I always know exactly where the SATA drives are located in the plain-old /dev tree and if I can call them
/dev/sdwor/dev/sdzrather than/dev/disk/by-id/ata-WDC_WD2500YS-01S-WD-WCANY1955037I added this to my local.rules and udevtest says it works great for the first drive I already have installed:
Quoted 6 lines
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", NAME="sdw"
As I add the other 3 drives I just need to add lines to identify their serial numbers and set them at sdx, sdy, and sdz.
If you change the default name of the nodes, you will never find the disk a possible error log from the kernel belongs to. You should only use symlinks.
/dev/disk/* has probably all you need already without any custom rule.
Kay
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 5 lines · Kay Sievers
If you change the default name of the nodes, you will never find the disk a possible error log from the kernel belongs to. You should only use symlinks.
So why providing this "shoot yourself in the foot" in the first place?
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · Andrey Borzenkov
Quoted 5 lines · Kay Sievers
If you change the default name of the nodes, you will never find the disk a possible error log from the kernel belongs to. You should only use symlinks.
So why providing this "shoot yourself in the foot" in the first place?
Because you need to move stuff to subdirectories like "input/" "snd/", want to rename network interfaces, have things like libusb device nodes /dev/bus/usb/, and other stuff where it is appropriate to do that.
Kay
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 18 lines · Kay Sievers
Quoted 9 lines · On 8/12/07, [email protected] <[email protected]> wrote:
Now, that being said, it will be a lot easier for *ME* if I always know exactly where the SATA drives are located in the plain-old /dev tree and if I can call them
/dev/sdwor/dev/sdzrather than/dev/disk/by-id/ata-WDC_WD2500YS-01S-WD-WCANY1955037I added this to my local.rules and udevtest says it works great for the first drive I already have installed:
Quoted 6 lines
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", NAME="sdw"
As I add the other 3 drives I just need to add lines to identify their serial numbers and set them at sdx, sdy, and sdz.
Quoted 7 lines
If you change the default name of the nodes, you will never find the disk a possible error log from the kernel belongs to. You should only use symlinks.
/dev/disk/*has probably all you need already without any custom rule.Kay
So, better would be:
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", SYMLINK+="sdw"
The disks will all be the same model so the info in /dev/disk will be the same except for a number or two. Too easy to mix them up if I'm looking for something specific while moving hardware around.
Gerald
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 24 lines · Gerald V. Livingston II
Quoted 22 lines · Kay Sievers
Quoted 9 lines · On 8/12/07, [email protected] <[email protected]> wrote:
Now, that being said, it will be a lot easier for *ME* if I always know exactly where the SATA drives are located in the plain-old /dev tree and if I can call them
/dev/sdwor/dev/sdzrather than/dev/disk/by-id/ata-WDC_WD2500YS-01S-WD-WCANY1955037I added this to my local.rules and udevtest says it works great for the first drive I already have installed:
Quoted 6 lines
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", NAME="sdw"
As I add the other 3 drives I just need to add lines to identify their serial numbers and set them at sdx, sdy, and sdz.
If you change the default name of the nodes, you will never find the disk a possible error log from the kernel belongs to. You should only use symlinks.
Quoted 7 lines
Quoted 1 line
/dev/disk/*has probably all you need already without any custom rule.So, better would be:
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", SYMLINK+="sdw"
Yes, symlinks are better in almost all cases. Still, make sure that nobody will ever connect a whole bunch of USB sticks. :) And hope the SCSI error handler will hang and repeated connect/disconnect of a single block device will produce a real "sdw" device in the kernel. It's a kind of a dangerous game to allocate names from the kernel namespace.
Quoted 3 lines
The disks will all be the same model so the info in
/dev/diskwill be the same except for a number or two. Too easy to mix them up if I'm looking for something specific while moving hardware around.
If you use rules later than 60-*.rules, ENV{ID_SERIAL} is already set by udev's persistent rules, and there is no need to run scsi_id again.
Kay
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 50 lines · Kay Sievers
Quoted 29 lines · Gerald V. Livingston II
Quoted 1 line · Kay Sievers
On 8/12/07, [email protected]
Quoted 3 lines
Quoted 2 lines · wrote:
Now, that being said, it will be a lot easier for *ME* if I always
know
Quoted 1 line
Quoted 1 line
exactly where the SATA drives are located in the plain-old /dev tree
and
Quoted 4 lines
Quoted 4 lines
if I can call them
/dev/sdwor/dev/sdzrather than/dev/disk/by-id/ata-WDC_WD2500YS-01S-WD-WCANY1955037I added this to my local.rules and udevtest says it works great for
the
Quoted 7 lines
Quoted 7 lines
first drive I already have installed:
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", NAME="sdw"
As I add the other 3 drives I just need to add lines to identify
their
Quoted 6 lines
Quoted 1 line
serial numbers and set them at sdx, sdy, and sdz.
If you change the default name of the nodes, you will never find the disk a possible error log from the kernel belongs to. You should only use symlinks.
Quoted 7 lines
Quoted 1 line
/dev/disk/*has probably all you need already without any custom rule.So, better would be:
KERNEL="sd*[!0-9]", IMPORT="/sbin/scsi_id -g -x $tempnode" KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", SYMLINK+="sdw"
Yes, symlinks are better in almost all cases. Still, make sure that nobody will ever connect a whole bunch of USB sticks. :) And hope the SCSI error handler will hang and repeated connect/disconnect of a single block device will produce a real "sdw" device in the kernel. It's a kind of a dangerous game to allocate names from the kernel namespace.
Quoted 4 lines
The disks will all be the same model so the info in
/dev/diskwill be the
same except for a number or two. Too easy to mix them up if I'm looking for something specific while moving hardware around.
Quoted 4 lines
If you use rules later than 60-*.rules, ENV{ID_SERIAL} is already set by udev's persistent rules, and there is no need to run
scsi_idagain.Kay
On my Debian system install persistent.rules runs at "z20" so I've moved my SATA rules file to z22_my.sata.rules.
Since nothing on the SYSTEM (only my brain) seems to require /dev/sd"x" to be static I've also changed the persistent symlinks to be more descriptive for me. The z22_my.sata.rules file is currently a single line:
KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", SYMLINK+="sata1"
This is a Sun E450 Server class machine with hardware plugged into it that Sun never intended when they built it in the '90s. I haven't decided if I want to try getting a USB controller installed. ;-)
Gerald
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 16 lines · Gerald V. Livingston II
Quoted 11 lines · Kay Sievers
Quoted 4 lines · Gerald V. Livingston II
The disks will all be the same model so the info in
/dev/diskwill be the
same except for a number or two. Too easy to mix them up if I'm looking for something specific while moving hardware around.If you use rules later than 60-*.rules, ENV{ID_SERIAL} is already set by udev's persistent rules, and there is no need to run
scsi_idagain.Kay
On my Debian system install persistent.rules runs at "z20" so I've moved my SATA rules file to z22_my.sata.rules.
Quoted 7 lines
Since nothing on the SYSTEM (only my brain) seems to require /dev/sd"x" to be static I've also changed the persistent symlinks to be more descriptive for me. The z22_my.sata.rules file is currently a single line:
KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", SYMLINK+="sata1"
This works great. Wherever the SATA drive end up in the chain it gets linked as /dev/sata1.
But, my brain is missing something else. I am doing LVM on these disks but not "whole device" LVM, so, I also need symlinks for /dev/sdd1 etc to be created as /dev/sata1_1, /dev/sata1_2, etc.
Never mind, I got it. But I'll post this for the archives anyway:
My SATA rules file (which runs AFTER the stock "persistent.rules" file) is now two line for the single drive I have installed. Other lines will be added for each drive I install later to link them to sata2 etc.
KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", SYMLINK+="sata1"
KERNEL="sd*[0-9]", ENV{ID_SERIAL}="SATA_WDC_WD2500YS-01_WD-WCANY1955037", SYMLINK+="sata1_%n"
Gerald
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel