[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: udev: same serial on different disks



On Wed, 17 Mar 2010 13:58:03 +0100, Ervin Hegedüs wrote:

>>> I would like to use two rules to identify disks when user attach one
>>> of them, but system doesn't sense which disk has attached.
>>
>> Give filesystems a "label" and use that to manage them. As they are
>> external disks for backup it should be fine.
> 
> hmm... how can I "catch" which is the label of the attached disk? 


"ls -l /dev/disk/by-label" will tell you if there is any current label on 
the filesystems. Look:

sm01@stt008:~$ ls -l /dev/disk/by-label
total 0
lrwxrwxrwx 1 root root 10 mar 17 07:50 ALFA -> ../../sda2
lrwxrwxrwx 1 root root 10 mar 17 07:50 system2 -> ../../sda3

I use to specify a label on partitions at install time, when formatting, 
even though I do not use it :-P.


> 'Cause
> (theorerically) udev gives disk id by disk phisycal attributes, eg
> serial...
> Label is _not_ a phisycal attribute (as I know).


Well, it's a physical attribute as soon as you write it on the disk :-)
 

> Is there any way?


You said before something about writting udev rules "to differentiate the 
disks". What is your main purpose on this? I mean, you can mount them 
using their "label" nomenclature :-?


>> Yes, but they get a different ID: one disks lasts with "B000" and the
>> other with "B0008". Curious :-S
> 
> hmmm... I think they didn't _get_ serial - they _have_ serial. and my
> problem is system can't recognize that. And it's more than curious... :P

I'm not sure this works when using USB enclosures (as not all ATA 
commands are passed to "smart"), but it is worth a try:

smartctl -i /dev/sdb
smartctl -i /dev/sdc

And put here the output (if any). That should give us more information 
(serial number, firmware release, etc...) about the drives.


>>> What could be the problem?
>>
>> Dunno, but you have many choices for designating the disks (label, id,
>> uuid and path). Choose your poison :-)
> 
> do you mean I have to read the symlink of devie, and determine the
> phisycal disk by that?


I mean you can use four methods to uniquely identify the devices.
 

> (but the question is still opened: why doesn't recognize the system the
> different
> serial numbers?)


It's possible the drives have indeed the same serial number, or just that 
udev is not gathering the right information from the right place, who 
knows... we have to dig a bit more.

Greetings,

-- 
Camaleón


Reply to: