FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 08-30-2010, 01:00 PM
Pau Peris
 
Default help with Persistent hard disk device names with udev

Hi, i would like to give persistent device names to the system hard
drives (just renaming its original device name to the one i want using
its serial number as identifier). I've created the following rules
which are not currently working. I'm trying to use device serial
numbers to properly set its device name. One of the main reasons for
doing that is i have a RAID composed by 3 disk (let's say sda sdc sdd)
and when i plug another 4 disks sda becomes sde, sdc becomes sdg and
so on while new drives take old device names, that's why i would like
to make it sure device names remains always the same.
Here are the rules
Código:

SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH", NAME="hda"
SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb"
SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G", NAME="sdc"
SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"

KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH", NAME="hda%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G", NAME="sdc%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc%n"


Should this work? Do some one know how can i get it to work? thanks in advanced
 
Old 08-30-2010, 01:32 PM
"J. Roeleveld"
 
Default help with Persistent hard disk device names with udev

On Monday 30 August 2010 15:00:28 Pau Peris wrote:
> Hi, i would like to give persistent device names to the system hard
> drives (just renaming its original device name to the one i want using
> its serial number as identifier). I've created the following rules
> which are not currently working. I'm trying to use device serial
> numbers to properly set its device name. One of the main reasons for
> doing that is i have a RAID composed by 3 disk (let's say sda sdc sdd)
> and when i plug another 4 disks sda becomes sde, sdc becomes sdg and
> so on while new drives take old device names, that's why i would like
> to make it sure device names remains always the same.
> Here are the rules
> Código:
>
> SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH", NAME="hda"
> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
> SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb"
> SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G", NAME="sdc"
> SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"
>
> KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH",
> NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM",
> NAME="sda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="3QD0X58D",
> NAME="sdb%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G",
> NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN",
> NAME="sdc%n"
>
> Should this work? Do some one know how can i get it to work? thanks in
> advanced

Hi,

You need to use double "=" for all the fields you want to match.
In other words, for sda, you need to use:
> SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda"
instead of:
> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"

Otherwise it doesn't match it correctly or will try to change the serial for
the all the block-devices it finds.

(I found this out when trying to rename my network-interfaces)

--
Joost
 
Old 08-30-2010, 02:17 PM
Pau Peris
 
Default help with Persistent hard disk device names with udev

Thx a lot!

2010/8/30 J. Roeleveld <joost@antarean.org>:
> On Monday 30 August 2010 15:00:28 Pau Peris wrote:
>> Hi, i would like to give persistent device names to the system hard
>> drives (just renaming its original device name to the one i want using
>> its serial number as identifier). I've created the following rules
>> which are not currently working. I'm trying to use device serial
>> numbers to properly set its device name. One of the main reasons for
>> doing that is i have a RAID composed by 3 disk (let's say sda sdc sdd)
>> and when i plug another 4 disks sda becomes sde, sdc becomes sdg and
>> so on while new drives take old device names, that's why i would like
>> to make it sure device names remains always the same.
>> Here are the rules
>> Código:
>>
>> SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH", NAME="hda"
>> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
>> SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb"
>> SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G", NAME="sdc"
>> SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"
>>
>> KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH",
>> NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM",
>> NAME="sda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="3QD0X58D",
>> NAME="sdb%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G",
>> NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN",
>> NAME="sdc%n"
>>
>> Should this work? Do some one know how can i get it to work? thanks in
>> advanced
>
> Hi,
>
> You need to use double "=" for all the fields you want to match.
> In other words, for sda, you need to use:
>> SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda"
> instead of:
>> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
>
> Otherwise it doesn't match it correctly or will try to change the serial for
> the all the block-devices it finds.
>
> (I found this out when trying to rename my network-interfaces)
>
> --
> Joost
>
>
 
Old 08-31-2010, 12:58 PM
Pau Peris
 
Default help with Persistent hard disk device names with udev

Hi, after following your tips the code gets like the following one:

SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH", NAME="hda"
SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda"
SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb"
SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G", NAME="sdc"
SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"

KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH", NAME="hda%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G", NAME="sdc%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}=="9VP0SBVN", NAME="sdc%n"
That's not working, when i plug more devices they get named without
taking care of the rules above. Do someone know why? thanks. i would
like to be able to name devies using its serial number. Thanks in
advanced

2010/8/30 Pau Peris <sibok1981@gmail.com>:
> Thx a lot!
>
> 2010/8/30 J. Roeleveld <joost@antarean.org>:
>> On Monday 30 August 2010 15:00:28 Pau Peris wrote:
>>> Hi, i would like to give persistent device names to the system hard
>>> drives (just renaming its original device name to the one i want using
>>> its serial number as identifier). I've created the following rules
>>> which are not currently working. I'm trying to use device serial
>>> numbers to properly set its device name. One of the main reasons for
>>> doing that is i have a RAID composed by 3 disk (let's say sda sdc sdd)
>>> and when i plug another 4 disks sda becomes sde, sdc becomes sdg and
>>> so on while new drives take old device names, that's why i would like
>>> to make it sure device names remains always the same.
>>> Here are the rules
>>> Código:
>>>
>>> SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH", NAME="hda"
>>> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
>>> SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb"
>>> SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G", NAME="sdc"
>>> SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"
>>>
>>> KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH",
>>> NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM",
>>> NAME="sda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="3QD0X58D",
>>> NAME="sdb%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G",
>>> NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN",
>>> NAME="sdc%n"
>>>
>>> Should this work? Do some one know how can i get it to work? thanks in
>>> advanced
>>
>> Hi,
>>
>> You need to use double "=" for all the fields you want to match.
>> In other words, for sda, you need to use:
>>> SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda"
>> instead of:
>>> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
>>
>> Otherwise it doesn't match it correctly or will try to change the serial for
>> the all the block-devices it finds.
>>
>> (I found this out when trying to rename my network-interfaces)
>>
>> --
>> Joost
>>
>>
>
 
Old 08-31-2010, 01:08 PM
Alex Schuster
 
Default help with Persistent hard disk device names with udev

Pau Peris writes:

> Hi, after following your tips the code gets like the following one:
>
> SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH", NAME="hda"
> SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda"
> SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb"
> SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G", NAME="sdc"
> SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"
>
> KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH",
> NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block",
> ATTR{serial}=="9QK0T4WM", NAME="sda%n" KERNEL=="sd*",
> SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb%n"
> KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G",
> NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block",
> ATTR{serial}=="9VP0SBVN", NAME="sdc%n" That's not working, when i plug
> more devices they get named without taking care of the rules above. Do
> someone know why? thanks. i would like to be able to name devies using
> its serial number. Thanks in advanced

Could it be that the sd* notation is somewhere hardwired in UDEV? I'd try
to give the devices different names, like NAME="myhda", and so on.

Just guessing,

Wonko
 
Old 08-31-2010, 01:52 PM
Dale
 
Default help with Persistent hard disk device names with udev

Alex Schuster wrote:

Pau Peris writes:



Hi, after following your tips the code gets like the following one:

SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH", NAME="hda"
SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda"
SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb"
SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G", NAME="sdc"
SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"

KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH",
NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block",
ATTR{serial}=="9QK0T4WM", NAME="sda%n" KERNEL=="sd*",
SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb%n"
KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G",
NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block",
ATTR{serial}=="9VP0SBVN", NAME="sdc%n" That's not working, when i plug
more devices they get named without taking care of the rules above. Do
someone know why? thanks. i would like to be able to name devies using
its serial number. Thanks in advanced


Could it be that the sd* notation is somewhere hardwired in UDEV? I'd try
to give the devices different names, like NAME="myhda", and so on.

Just guessing,

Wonko




This is a shot in the dark but just in case. What did you name the
rules file? Is it possible that it is reading your file then reading
another file udev generated and the last one it reads is the one that
sets the names? I would look to see if there is another file in the
rules.d directory that sets the naming and then see what udev reads last.


Again, shot in the dark and this may not apply.

Dale

:-) :-)
 
Old 08-31-2010, 07:33 PM
Pau Peris
 
Default help with Persistent hard disk device names with udev

Hi, thanks a lot for the answers. The name of the rules file is
00_whatever.rules, as far as i know there's also an option which
prevents to modifye the setted rules. Well, if no one knows how to do
i will try to find a different solution.

2010/8/31 Dale <rdalek1967@gmail.com>:
> Alex Schuster wrote:
>>
>> Pau Peris writes:
>>
>>
>>>
>>> Hi, after following your tips the code gets like the following one:
>>>
>>> SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH", NAME="hda"
>>> SUBSYSTEM=="block", ATTR{serial}=="9QK0T4WM", NAME="sda"
>>> SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb"
>>> SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G", NAME="sdc"
>>> SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"
>>>
>>> KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}=="VNVB05G2RKTRZH",
>>> NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block",
>>> ATTR{serial}=="9QK0T4WM", NAME="sda%n" KERNEL=="sd*",
>>> SUBSYSTEM=="block", ATTR{serial}=="3QD0X58D", NAME="sdb%n"
>>> KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}=="9QK0RS9G",
>>> NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block",
>>> ATTR{serial}=="9VP0SBVN", NAME="sdc%n" That's not working, when i plug
>>> more devices they get named without taking care of the rules above. Do
>>> someone know why? thanks. i would like to be able to name devies using
>>> its serial number. Thanks in advanced
>>>
>>
>> Could it be that the sd* notation is somewhere hardwired in UDEV? I'd try
>> to give the devices different names, like NAME="myhda", and so on.
>>
>> Just guessing,
>>
>> * * * *Wonko
>>
>>
>
> This is a shot in the dark but just in case. *What did you name the rules
> file? *Is it possible that it is reading your file then reading another file
> udev generated and the last one it reads is the one that sets the names? *I
> would look to see if there is another file in the rules.d directory that
> sets the naming and then see what udev reads last.
>
> Again, shot in the dark and this may not apply.
>
> Dale
>
> :-) *:-)
>
>
 
Old 09-01-2010, 11:31 AM
David Relson
 
Default help with Persistent hard disk device names with udev

My udev rules use a combination of KERNEL, ATTRS(serial), and SYMLINK to
create named entries in /dev for my 2 USB hard drives.

With the following rules in /etc/udev/rules.d/10-local.rules:

KERNEL=="sd*", ATTRS{serial}=="FD...7264507", SYMLINK+="WD1"
KERNEL=="sd*", ATTRS{serial}=="FD...7285643", SYMLINK+="WD2"

Plugging them in results in /dev entries like:

brw-rw---- 1 root disk 8, 32 Aug 21 13:55 sdc
lrwxrwxrwx 1 root root 3 Aug 21 13:55 WD1 -> sdc
brw-rw---- 1 root disk 8, 32 Aug 21 13:55 sdd
lrwxrwxrwx 1 root root 3 Aug 21 13:55 WD2 -> sdd

And in /etc/fstab, I reference /dev/WD1 and /dev/WD2

HTH,

David

On Mon, 30 Aug 2010 15:00:28 +0200
Pau Peris wrote:

> Hi, i would like to give persistent device names to the system hard
> drives (just renaming its original device name to the one i want using
> its serial number as identifier). I've created the following rules
> which are not currently working. I'm trying to use device serial
> numbers to properly set its device name. One of the main reasons for
> doing that is i have a RAID composed by 3 disk (let's say sda sdc sdd)
> and when i plug another 4 disks sda becomes sde, sdc becomes sdg and
> so on while new drives take old device names, that's why i would like
> to make it sure device names remains always the same.
> Here are the rules
> Código:
>
> SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH", NAME="hda"
> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
> SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb"
> SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G", NAME="sdc"
> SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"
>
> KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH",
> NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block",
> ATTR{serial}="9QK0T4WM", NAME="sda%n" KERNEL=="sd*",
> SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb%n"
> KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G",
> NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block",
> ATTR{serial}="9VP0SBVN", NAME="sdc%n"
>
>
> Should this work? Do some one know how can i get it to work? thanks
> in advanced
 
Old 09-01-2010, 01:37 PM
Neil Bothwick
 
Default help with Persistent hard disk device names with udev

On Tue, 31 Aug 2010 21:33:01 +0200, Pau Peris wrote:

> Hi, thanks a lot for the answers. The name of the rules file is
> 00_whatever.rules, as far as i know there's also an option which
> prevents to modifye the setted rules.

PARAM:=value

The colon says don't let a subsequent rule change this.


--
Neil Bothwick

Biology is the only science in which multiplication means the same thing
as division.
 
Old 10-09-2010, 11:58 AM
Matthias Schwarzott
 
Default help with Persistent hard disk device names with udev

On Monday 30 August 2010, Pau Peris wrote:
> Hi, i would like to give persistent device names to the system hard
> drives (just renaming its original device name to the one i want using
> its serial number as identifier). I've created the following rules
> which are not currently working. I'm trying to use device serial
> numbers to properly set its device name. One of the main reasons for
> doing that is i have a RAID composed by 3 disk (let's say sda sdc sdd)
> and when i plug another 4 disks sda becomes sde, sdc becomes sdg and
> so on while new drives take old device names, that's why i would like
> to make it sure device names remains always the same.
> Here are the rules
> Código:
>
> SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH", NAME="hda"
> SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM", NAME="sda"
> SUBSYSTEM=="block", ATTR{serial}="3QD0X58D", NAME="sdb"
> SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G", NAME="sdc"
> SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN", NAME="sdc"
>
> KERNEL=="hd*", SUBSYSTEM=="block", ATTR{serial}="VNVB05G2RKTRZH",
> NAME="hda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0T4WM",
> NAME="sda%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="3QD0X58D",
> NAME="sdb%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9QK0RS9G",
> NAME="sdc%n" KERNEL=="sd*", SUBSYSTEM=="block", ATTR{serial}="9VP0SBVN",
> NAME="sdc%n"
>
>
> Should this work? Do some one know how can i get it to work? thanks in
> advanced

It could work if you fixed the rules as the other answers told you, but PLEASE
don't do this!

There are a lot of arguments like dmesg output and sysfs content will no
longer match userspace observations.
It will break once there is another disk that is not renamed and gets
KERNEL=sda assigned.

Why do you not just use /dev/disk/by-* links as everyone else does?

Regard
Matthias
 

Thread Tools




All times are GMT. The time now is 09:47 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org