LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 01-25-2009, 06:03 AM   #1
Thure
LQ Newbie
 
Registered: Jan 2009
Location: Sweden
Distribution: Debian Etch
Posts: 2

Rep: Reputation: 0
Hotswap and udev persisten naming


Hi!

I just my first hotswapmachine (HP DL-320 G5p) with Debian Etch r03, and i have som problems with the kernelnames.
I have two SATA-Hotswap disks, and their names are sda and sdb in the system.

Now the problem.
When i use the command "scsiadd -r 1 0 0 0" the system successfully disables the sdb disk. I can remove and reinsert de disk without any problems. But when i use the "sciadd -s" and "scsiadd -a 1 0 0 0" the kernelname is sdc. If i reboot the server everything is back to normal, but then the whole idea of a hotswapdisc is gone :-).

So iīve started reading about the udev rules, and i have done so for the past 6 hours, but i canīt find anyway to write a rule that identifies the diskbay.

Does anyone have a tip, or maybe solultion for me?

Thanks in advance.

/Rikard



Here is what udevmonitor says during the process.

udevmonitor prints the received event from the kernel [UEVENT]
and the event which udev sends out after rule processing [UDEV]

Comment: After scsiadd -r 1 0 0 0

UEVENT[1214101065.731485] remove@/class/scsi_generic/sg1
UEVENT[1214101065.731510] remove@/class/scsi_device/1:0:0:0
UEVENT[1214101065.732296] remove@/class/scsi_disk/1:0:0:0
UEVENT[1214101065.732307] remove@/block/sdb/sdb7
UEVENT[1214101065.732314] remove@/block/sdb/sdb6
UEVENT[1214101065.732320] remove@/block/sdb/sdb5
UEVENT[1214101065.732326] remove@/block/sdb/sdb2
UEVENT[1214101065.732333] remove@/block/sdb/sdb1
UEVENT[1214101065.732339] remove@/block/sdb
UEVENT[1214101065.732345] remove@/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0
UDEV [1214101065.732933] remove@/class/scsi_generic/sg1
UDEV [1214101065.733232] remove@/class/scsi_device/1:0:0:0
UDEV [1214101065.733654] remove@/class/scsi_disk/1:0:0:0
UDEV [1214101065.735209] remove@/block/sdb/sdb7
UDEV [1214101065.735714] remove@/block/sdb/sdb6
UDEV [1214101065.736224] remove@/block/sdb/sdb5
UDEV [1214101065.736701] remove@/block/sdb/sdb2
UDEV [1214101065.737193] remove@/block/sdb/sdb1
UDEV [1214101065.737642] remove@/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0
UDEV [1214101065.738035] remove@/block/sdb

Comment: After scsiadd -a 1 0 0 0

UEVENT[1214101203.673402] add@/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0
UEVENT[1214101203.673430] add@/class/scsi_disk/1:0:0:0
UEVENT[1214101203.733862] add@/block/sdc
UEVENT[1214101203.733873] add@/block/sdc/sdc1
UEVENT[1214101203.733881] add@/block/sdc/sdc2
UEVENT[1214101203.733888] add@/block/sdc/sdc5
UEVENT[1214101203.733895] add@/block/sdc/sdc6
UEVENT[1214101203.733903] add@/block/sdc/sdc7
UEVENT[1214101203.733994] add@/class/scsi_device/1:0:0:0
UEVENT[1214101203.734034] add@/class/scsi_generic/sg1
UDEV [1214101203.757793] add@/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0
UDEV [1214101203.758932] add@/class/scsi_disk/1:0:0:0
UDEV [1214101203.761765] add@/class/scsi_device/1:0:0:0
UDEV [1214101203.762538] add@/class/scsi_generic/sg1
UDEV [1214101203.829821] add@/block/sdc
UDEV [1214101203.844369] add@/block/sdc/sdc1
UDEV [1214101203.845374] add@/block/sdc/sdc2
UDEV [1214101203.868438] add@/block/sdc/sdc5
UDEV [1214101203.886044] add@/block/sdc/sdc7
UDEV [1214101203.899746] add@/block/sdc/sdc6
 
Old 01-25-2009, 08:08 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can use "udevinfo" to select what would be the best way identify the devices.
I think it would be better to use uuid #'s for rules on removable devices. Look at the /etc/rules.d/70-kpartx as an example. You definitely want to use LABEL= or UUID= in your /etc/fstab entries.

You can also use lshal to discover how hal identifies your devices.
 
Old 01-26-2009, 03:38 AM   #3
Thure
LQ Newbie
 
Registered: Jan 2009
Location: Sweden
Distribution: Debian Etch
Posts: 2

Original Poster
Rep: Reputation: 0
Hi, thanks for the quick reply.

As i understood your advices above, they adds the drive-id to the kernelname "sdb".
Itīs not the specific drive i wanīt to add as "sda" or "sdb", but any drive that is putted in to the specific drivebay.

Below is a printout from my udevinfo on sdb. (udevinfo -q all -a -p /sys/block/sdb).
But the only value that i can se being connected to the drivebay is the
KERNELS=="1:0:0:0" value. Is it possible to write a rule with it?
And if so, can you give me a tip on how to write it?

Thanks in advance

/Rikard


Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/block/sdb':
KERNEL=="sdb"
SUBSYSTEM=="block"
DRIVER==""
ATTR{stat}==" 1443 1281 54660 7984 665 1564 18280 160124 0 17960 168108"
ATTR{size}=="488397168"
ATTR{removable}=="0"
ATTR{range}=="16"
ATTR{dev}=="8:16"

looking at parent device '/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1 :0:0:0':
KERNELS=="1:0:0:0"
SUBSYSTEMS=="scsi"
DRIVERS=="sd"
ATTRS{ioerr_cnt}=="0x0"
ATTRS{iodone_cnt}=="0x84a"
ATTRS{iorequest_cnt}=="0x84a"
ATTRS{iocounterbits}=="32"
ATTRS{timeout}=="30"
ATTRS{state}=="running"
ATTRS{rev}=="HPG2"
ATTRS{model}=="GB0250C8045 "
ATTRS{vendor}=="ATA "
ATTRS{scsi_level}=="6"
ATTRS{type}=="0"
ATTRS{queue_type}=="none"
ATTRS{queue_depth}=="1"
ATTRS{device_blocked}=="0"

looking at parent device '/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0':
KERNELS=="target1:0:0"
SUBSYSTEMS==""
DRIVERS==""

looking at parent device '/devices/pci0000:00/0000:00:1f.2/host1':
KERNELS=="host1"
SUBSYSTEMS==""
DRIVERS==""

looking at parent device '/devices/pci0000:00/0000:00:1f.2':
KERNELS=="0000:00:1f.2"
SUBSYSTEMS=="pci"
DRIVERS=="ata_piix"
ATTRS{broken_parity_status}=="0"
ATTRS{enable}=="1"
ATTRS{modalias}=="pci:v00008086d00002920sv0000103Csd000031FEbc01sc01i8f"
ATTRS{local_cpus}=="ff"
ATTRS{irq}=="90"
ATTRS{class}=="0x01018f"
ATTRS{subsystem_device}=="0x31fe"
ATTRS{subsystem_vendor}=="0x103c"
ATTRS{device}=="0x2920"
ATTRS{vendor}=="0x8086"

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
 
Old 01-26-2009, 06:41 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you follow up the chain, some of the messages should have attributes that match the drive bay.

Perhaps if you insert a drive, and use udevinfo to identify the UUID of the filesystems on the partitions, you could create entries in /etc/fstab which reference the UUID or the LABELs instead of the device in the first field. This is what is done for external drives which may be assigned different device nodes depending on the order they are plugged in.

Here is an example of such an fstab entry. This one is for the root partition on a fixed drive:
Code:
UUID=45bd38f1-5b46-41fe-ad97-daef6e9ceab0 /boot                   ext3    defaults        1 2
The reason to do this also for fixed drives is to have a persistance reference to a filesystem, even if you create a new partition.
In your case you don't want a partition being /dev/sdb1 one time and /dev/sdc1 sometime else. In my example, you don't want /dev/sdb4 changing to /dev/sdb5 if another partition was resized and a new partition created.
 
  


Reply



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
Changing UDEV persistent naming schemes orbit Slackware 5 04-21-2008 09:22 PM
hotswap disk linuxtesting2 Solaris / OpenSolaris 3 06-28-2006 11:17 AM
Is there a way to have grub translate its own naming to naming scheme under Linux zhjim Linux - Software 6 05-28-2006 08:09 AM
SATA hotswap kwlg Linux - Hardware 3 06-28-2005 02:57 AM
mail server the naming naming convention problem kashan Linux - Newbie 0 07-16-2004 02:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:13 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration