LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-26-2011, 10:05 PM   #1
Devyn
Member
 
Registered: Oct 2004
Posts: 52

Rep: Reputation: 15
Persistent naming of /dev/sd[a-z] devices. How could I achieve this?


Hello All,

I notice UDEV already creates a number of links to point to standard device names like sda, sdb, sdc etc. for hard disks:

6318 lrwxrwxrwx. 1 root root 9 Dec 26 22:21 scsi-SATA_ST31000520AS_9VX0X994 -> ../../sda
6315 lrwxrwxrwx. 1 root root 9 Dec 26 22:21 ata-ST31000520AS_9VX0X994 -> ../../sda
6324 lrwxrwxrwx. 1 root root 9 Dec 26 22:21 wwn-0x5000c50026cddb36 -> ../../sda

However, I notice these are not persistent across reboots or when new hardware is added.

For example, udev might assign ata-ST31000520AS_9VX0X994 to sda but when another drive is added, ata-ST31000520AS_9VX0X994 now magically points to sdb while sda get's the serial number of the newly installed device.

When viewing through files such as the following:

/lib/udev/rules.d/60-persistent-storage.rules

# USB devices use their own serial number
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
# ATA devices with their own "ata" kernel subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode"
# ATA devices using the "scsi" subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode"
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi"

The above looks to me upon further reading the kernel might have something to do with associating the sd[a-z] devices with the physical device and serial numbers etc including their ordering upon which udev creates the links.

How could I ensure that udev or the kernel links point consistently to the same physical device and device name across reboots or new hardware being added? Also how could I define the associations manually and ensure they are presistent?

I'm using an RHEL 6.1 clone: Scientific Linux 6.1.

Thanks,
Devyn
 
Old 12-26-2011, 10:24 PM   #2
sinuhe
Member
 
Registered: Apr 2010
Location: Utah
Distribution: Slackware
Posts: 42

Rep: Reputation: 4
/dev/disk/

I'm not sure, but with labels and UUID persistence can be achieved, if that is the goal.
 
Old 12-26-2011, 10:27 PM   #3
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,325

Rep: Reputation: 772Reputation: 772Reputation: 772Reputation: 772Reputation: 772Reputation: 772Reputation: 772
It's not exactly what you're asking but I changed to using UUIDs in my fstab so that I could mount my drives in this kind of situation.
 
Old 12-26-2011, 10:37 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,201

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
In point of fact for (complete) persistence you should use by-id. Both UUID and LABEL are subject to change.
 
Old 12-26-2011, 10:47 PM   #5
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,325

Rep: Reputation: 772Reputation: 772Reputation: 772Reputation: 772Reputation: 772Reputation: 772Reputation: 772
Quote:
Originally Posted by syg00 View Post
In point of fact for (complete) persistence you should use by-id. Both UUID and LABEL are subject to change.
How likely are UUIDs to change? I'm OK for now but would be good to future proof if necessary.
 
Old 12-26-2011, 10:55 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,201

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
mkfs and mkswap both alter the UUID. Then there is uuidgen.

Another thing to consider if you ever use dd to backup a partition - both will have the same UUID. So much for unique ...

Last edited by syg00; 12-26-2011 at 10:56 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 15 naming network devices lealsaballos Linux - Networking 1 06-23-2011 08:49 PM
persistent device naming problem d-niX Linux - Server 7 02-24-2011 02:42 AM
SCSI/Fiber Devices Naming IwantLINUX Linux - Server 3 05-12-2010 02:17 PM
Help on naming iscsi devices with udev TheR_ Linux - Server 1 09-09-2009 07:46 AM
Changing UDEV persistent naming schemes orbit Slackware 5 04-21-2008 09:22 PM


All times are GMT -5. The time now is 01:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration