SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-03-04 11:15:31

xmid
Member
From: Appalachia-villeburgstedston
Registered: 2013-02-22
Posts: 13

[Solved] udev advice if possible, please )

Hello all,
I'm not sure if this is the place for my question, but I'm sure that getting to a point of exhaustion isn't something new to most when it comes to digging around for answers while not even sure how to properly state the question in a search string.

If anyone is interested, here is the situation:

Udev - I'm trying to write a set of persistent rules to set my 3 internal SATA drives to sda, sdb and sdc, respectively and in the order I have them attached to the motherboard. I know, it's a small thing, but I like to just keep things in as much order as possible, even if just for the sake of simplicity.

Normally there isn't a need to do this, however I recently blew the dust off an old iOmega 120G external USB drive and cleaned it up, attached it to my main box and piddled about for a bit. Upon rebooting, however, it seems to have bumped itself into the position of sdb, causing two of my internals to be sdc and sdd. Again, it's a small thing, but again, I like orderly - and orderly is most certainly an opinion despite the common understanding of the term.

I've found tutorials, write-ups, etc... all saying the same things about the various key pair combos to use, and in theory they all seem simple and sound until its time to reboot; however, every now and then during my little quest for the a.b.c.'ness, I come across small hints of not being able to rename device nodes at all, and to use SYMLINK instead - and that simply isn't an option I'm afraid. I don't like the idea of it.

From what I can tell, the kernel determines device node creation based upon a certain set of factors, that much should be obvious. But that also tells me that while some aspects of the naming may be random, it's most certainly a very structured form of random and it leaves me curious as to why my external drive seems to want to climb higher on the ladder than my internals.

I don't want to use a naming convention outside of the standard sd*, which is what SYMLINK would cause me to do, I have too many scripts, links, etc... based upon it and most of them are portable and work well when installing to a new box or reinstalling to a current one. It's a nice, 3 letter convention and I only stress about the internal drives to be honest, let the chips fall where they may on the rest.

I guess my question now is 2-part,  A: Is this a good place to ask advice on this? and B: Can it be done?

I'd be happy with just an up-to-date link in the proper direction if it's not too much to ask.

Thank you for your time, and sorry for the utter newness on udev and it's inner-workings. I've never really "had" to worry about it before.

EDIT:
It seems as though my initial suspicion may be correct, and to flat-out rename(not SYMLINK) say, sd(d) to sd(c), is no longer an option. At least, not with using udev and it's feature for persistent-rules. It seems also that this change was implemented intentionally by udev's developers in order to resolve various issues, etc...

All good I guess, what can ya do sometimes? smile

Last edited by xmid (2013-03-06 05:46:46)


Education != Intelligence.
Education is memorized methods, techniques and static data.
Intelligence allows you to actually do something with your education and create beyond it.

Offline

Be excellent to each other!

#2 2013-03-04 11:42:24

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: [Solved] udev advice if possible, please )

Perhaps this article can be of some help.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#3 2013-03-04 13:42:00

scket
#! CrunchBanger
From: West Midlands
Registered: 2009-01-16
Posts: 221

Re: [Solved] udev advice if possible, please )

This link was recommended in a Linux Format tutorial 1 few issues ago:
http://www.reactivated.net/writing_udev_rules.html

Offline

#4 2013-03-04 14:03:45

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: [Solved] udev advice if possible, please )

Here is a working snippet for usb disks:

# Symlink multi-part device
SUBSYSTEMS=="usb", ATTRS{serial}=="104000000000000031FF", KERNEL=="sd[a-z]", SYMLINK+="medion1"
SUBSYSTEMS=="usb", ATTRS{serial}=="104000000000000031FF", KERNEL=="sd[a-z][1-9]", SYMLINK+="medion1%n"
SUBSYSTEMS=="usb", ATTRS{serial}=="104000000000000031FF", KERNEL=="sd[a-z][1-9][0-9]", SYMLINK+="medion1%n"

SUBSYSTEMS=="usb", ATTRS{serial}=="001CC07E7A4BFC40370823EF", KERNEL=="sd[a-z]", SYMLINK+="kingston3"
SUBSYSTEMS=="usb", ATTRS{serial}=="001CC07E7A4BFC40370823EF", KERNEL=="sd[a-z][1-9]", SYMLINK+="kingston3%n"
SUBSYSTEMS=="usb", ATTRS{serial}=="001CC07E7A4BFC40370823EF", KERNEL=="sd[a-z][1-9][0-9]", SYMLINK+="kingston3%n"

I have this code in /etc/udev/rules.d/00-local-usb.rules, a file I created myself.
This is for a 2TB medion external USB disk, who's partitions get mounted under /dev/medion1, /dev/medion2, etc...
and a Kingston 8GB tumbdrive.

Use the info from the archlinux wiki
to find the appropriate attribute values for your devices.

cheers

Last edited by xaos52 (2013-03-04 14:06:57)

Offline

#5 2013-03-05 05:10:42

xmid
Member
From: Appalachia-villeburgstedston
Registered: 2013-02-22
Posts: 13

Re: [Solved] udev advice if possible, please )

Thank you all for taking the time to answer,

Unia wrote:

Perhaps this article can be of some help.

This seems to have potential, I will give this a thorough go-through when the chance arises later on, thank you so much.
************


scket wrote:

This link was recommended in a Linux Format tutorial 1 few issues ago:
http://www.reactivated.net/writing_udev_rules.html

Yes, this is one of the many pages I used in coming to my current conclusions. It seems as though this method did work and was the prefered one to use, however, it seems that in some recent or not so recent changes with udev itself, it no longer allows actual NAME="" changes to device nodes. Still, thank you just the same for your efforts, its appreciated.
************


xaos52 wrote:

Here is a working snippet for usb disks:

# Symlink multi-part device
SUBSYSTEMS=="usb", ATTRS{serial}=="104000000000000031FF", KERNEL=="sd[a-z]", SYMLINK+="medion1"
SUBSYSTEMS=="usb", ATTRS{serial}=="104000000000000031FF", KERNEL=="sd[a-z][1-9]", SYMLINK+="medion1%n"
SUBSYSTEMS=="usb", ATTRS{serial}=="104000000000000031FF", KERNEL=="sd[a-z][1-9][0-9]", SYMLINK+="medion1%n"

SUBSYSTEMS=="usb", ATTRS{serial}=="001CC07E7A4BFC40370823EF", KERNEL=="sd[a-z]", SYMLINK+="kingston3"
SUBSYSTEMS=="usb", ATTRS{serial}=="001CC07E7A4BFC40370823EF", KERNEL=="sd[a-z][1-9]", SYMLINK+="kingston3%n"
SUBSYSTEMS=="usb", ATTRS{serial}=="001CC07E7A4BFC40370823EF", KERNEL=="sd[a-z][1-9][0-9]", SYMLINK+="kingston3%n"

I have this code in /etc/udev/rules.d/00-local-usb.rules, a file I created myself.
This is for a 2TB medion external USB disk, who's partitions get mounted under /dev/medion1, /dev/medion2, etc...
and a Kingston 8GB tumbdrive.

Use the info from the archlinux wiki
to find the appropriate attribute values for your devices.

cheers

This would work without a doubt, however, SYMLINK is the very thing I am trying to avoid. I'm eager to simply rename the device in general in order to use the sda, sdb, sdc naming convention for my 3 internal drives permanently. Despite that, you took the time to answer and I very much appreciate your time and effort. And when it comes to my external devices, this is probably a method I wouldn't mind using at all smile


Education != Intelligence.
Education is memorized methods, techniques and static data.
Intelligence allows you to actually do something with your education and create beyond it.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo