LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-28-2008, 04:16 PM   #1
Misel
Member
 
Registered: Mar 2003
Location: Berlin
Distribution: Slackware current
Posts: 310

Rep: Reputation: 31
udev keeps changing sd* devices


My system has two SATA controllers. Two harddiscs are connected to the onboard (VIA) controller and a DVD-writer is connected to a PCIe-controller with a SIL chipset.

Depending on the "mood of the system" the DVD-writer is either /dev/sda or /dev/sdc. But the HDDs and writer can be used without trouble. I'm already using UUIDs in /etc/fstab.

BUT ...

I run munin to constantly check on the SMART values and this is the part where it's becoming trouble some. Because /dev/sda is not constantly linked to a HDD smartctl fails and cannot track.

Using udev I try to create two extra symlinks to the HDD devices but this is where I fail. With the help of several guides I came up with the following rules, but they don't work. And I simply cannot find out why.

I created an extra rules-file named /etc/udev/rules.d/60-misel.rules. The 60 is taken from the README which suggests to use 60 for "60 rules that add symlinks to device nodes (adds to those set in earlier rules)".


Code:
SUBSYSTEMS=="scsi", ATTRS{model}=="SAMSUNG SP2504C ", SYMLINK+='samsung250'
SUBSYSTEMS=="scsi", ATTRS{model}=="SAMSUNG HD320KJ ", SYMLINK+='samsung320'
From my understanding this should create one extra symlinks for each hard disc. But it doesn't. I know there's a trailing space but this is what "udevinfo -a -p /block/sdb" reports. Trimming this space doesn't help either.

I've also tried other rules that I've came across such as these.

Code:
SUBSYSTEM=="block", ATTR{size}=="488397168", SYMLINK+='samsung250'
SUBSYSTEMS=="scsi", KERNELS=="host5", SYMLINK+="Drawer"
The first one doesn't work at all, too. The second one kinda works but it creates a link to a (seemingly) random partition on that disc. As a result it doesn't work with smartctl.

I'm using Xubuntu 8.10 and it's quite frustrating not to have udevtest around which is mentioned on some sites. So I have to reboot each time I want to test a change. I also don't get very much out of the udev logs.

I fear it's something really obvious but I just can't find it. Can you please help me?
 
Old 11-28-2008, 06:19 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
edit try udev rules links

http://reactivated.net/writing_udev_rules.html

http://linuxvm.org/present/WAVV/udev.pdf

http://www.linuxjournal.com/article/7316

Last edited by aus9; 11-28-2008 at 06:24 PM.
 
Old 11-29-2008, 04:06 AM   #3
Misel
Member
 
Registered: Mar 2003
Location: Berlin
Distribution: Slackware current
Posts: 310

Original Poster
Rep: Reputation: 31
I cannot count the number of udev guides that I already read. And the first link you provided suggests exactly that rule, that I already tried and didn't work.

From the guide:
Code:
SUBSYSTEM=="block", ATTR{size}=="234441648", SYMLINK+="my_disk"
My line
Code:
SUBSYSTEM=="block", ATTR{size}=="488397168", SYMLINK+='samsung250'
Result on my side nothing.

I entered a faulty rule in the file and got a message that there is an error. So my own-rules-file is not ignored.

Here's the output of udevinfo for this drive

Quote:
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 '/devices/pci0000:00/0000:00:0f.0/host4/target4:0:0/4:0:0:0/block/sdb':
KERNEL=="sdb"
SUBSYSTEM=="block"
DRIVER==""
ATTR{range}=="16"
ATTR{removable}=="0"
ATTR{ro}=="0"
ATTR{size}=="488397168"
ATTR{capability}=="12"
ATTR{stat}==" 344132 51878 8115033 2367972 762371 1536011 18410472 8118440 0 2134752 10486852"

looking at parent device '/devices/pci0000:00/0000:00:0f.0/host4/target4:0:0/4:0:0:0/block':
KERNELS=="block"
SUBSYSTEMS==""
DRIVERS==""

looking at parent device '/devices/pci0000:00/0000:00:0f.0/host4/target4:0:0/4:0:0:0':
KERNELS=="4:0:0:0"
SUBSYSTEMS=="scsi"
DRIVERS=="sd"
ATTRS{device_blocked}=="0"
ATTRS{type}=="0"
ATTRS{scsi_level}=="6"
ATTRS{vendor}=="ATA "
ATTRS{model}=="SAMSUNG SP2504C "
ATTRS{rev}=="VT10"
ATTRS{state}=="running"
ATTRS{timeout}=="30"
ATTRS{iocounterbits}=="32"
ATTRS{iorequest_cnt}=="0x10ed2f"
ATTRS{iodone_cnt}=="0x10ed2f"
ATTRS{ioerr_cnt}=="0x36c"
ATTRS{modalias}=="scsi:t-0x00"
ATTRS{evt_media_change}=="0"
ATTRS{queue_depth}=="1"
ATTRS{queue_type}=="none"

looking at parent device '/devices/pci0000:00/0000:00:0f.0/host4/target4:0:0':
KERNELS=="target4:0:0"
SUBSYSTEMS=="scsi"
DRIVERS==""

looking at parent device '/devices/pci0000:00/0000:00:0f.0/host4':
KERNELS=="host4"
SUBSYSTEMS=="scsi"
DRIVERS==""

looking at parent device '/devices/pci0000:00/0000:00:0f.0':
KERNELS=="0000:00:0f.0"
SUBSYSTEMS=="pci"
DRIVERS=="sata_via"
ATTRS{vendor}=="0x1106"
ATTRS{device}=="0x0591"
ATTRS{subsystem_vendor}=="0x1106"
ATTRS{subsystem_device}=="0x0591"
ATTRS{class}=="0x01018f"
ATTRS{irq}=="21"
ATTRS{local_cpus}=="00000000,00000003"
ATTRS{local_cpulist}=="0-1"
ATTRS{modalias}=="pci:v00001106d00000591sv00001106sd00000591bc01sc01i8f"
ATTRS{numa_node}=="0"
ATTRS{broken_parity_status}=="0"
ATTRS{msi_bus}==""

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""

Last edited by Misel; 11-29-2008 at 04:11 AM.
 
Old 11-30-2008, 01:47 AM   #4
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
I know they are diff sizes but are these disks used in a raid?

if not in raid...are they both used in essential fstab mounting system partitions...not data etc?

I am thinking...lets try removing the non-essential from bios...and make a funny udev rule that proves the rule works....and then try again with both drives
 
Old 11-30-2008, 05:57 AM   #5
Misel
Member
 
Registered: Mar 2003
Location: Berlin
Distribution: Slackware current
Posts: 310

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by aus9 View Post
I know they are diff sizes but are these disks used in a raid?
No, they're not part of any RAID system.

Quote:
Originally Posted by aus9 View Post
if not in raid...are they both used in essential fstab mounting system partitions...not data etc?
The "samsung250" contains the root and home partition. The "samsung320" contains Windows XP and a data partition.

Quote:
Originally Posted by aus9 View Post
I am thinking...lets try removing the non-essential from bios...and make a funny udev rule that proves the rule works....and then try again with both drives
That sounds reasonable. But where do I start? The rules I came up with cannot really be made anything shorter.
 
Old 11-30-2008, 10:09 AM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
There might be 2 more tools in the udev toolbox, dunno if you have seen them. One is udevtest to see which rules are being applied, the other one is udevtrigger, which let you re-iterate thru the device creation process without actually unplugging the hardware.

Also, you can set the log level to debug an discover why udev renames devices by looking into the logs.

(Set the log level to debug, restart udev, trigger the devices)

There have been some changes in the udev programs, udevtest disappeared in favor of 'udevadm test', etc. Use the man page for udevadm and try to find from there the test and trigger programs I mentioned.

jlinkels
 
  


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
Accessing devices from udev Jzarecta Linux - Hardware 4 07-11-2007 07:25 PM
Udev linking my devices wrong Wynd Linux - General 1 01-20-2007 05:21 AM
Udev & devices trouble Macky Slackware 1 12-01-2005 02:11 PM
UDEV and Raw devices swissworks Slackware 6 09-14-2004 01:08 PM
udev and 51 sound devices! tamills Linux - Hardware 0 05-15-2004 05:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:07 PM.

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