LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-24-2007, 09:22 PM   #1
Ruler2112
Member
 
Registered: Oct 2004
Location: Michigan, US
Distribution: Redhat 7.3, 9.0; Slackware 10, 10.1, 10.2, 11; FreeBSD 7.0; KnoppMyth 5.5
Posts: 125

Rep: Reputation: 16
Lightbulb Static /dev nodes for USB drives - Solution


Anybody who has used more than one flash drive in Linux will probably know what I'm talking about here. In a normal Linux system, in order to mount a USB mass storage device, you have to mount /dev/sd?1, the exact letter of which would start with a and continue on for each physical device you plugged in. If you plug in the same drive again, it would retain the same sd? node. However, when the usb-storage module is unloaded/reloaded, the process starts over again, meaning that you either have to run fdisk -l as root each time you plug in a drive or remember what letter each is for every time you boot your machine.

Well, I got really sick of doing this, searched for a solution, and (surprising to me) did not find one. I found quite a few threads that discussed the problem and supposedly udev does something like this in the 2.6 series kernels, but is complex, slow, and buggy from the reports I've seen. I also am a fan of Slackware, which installs with the 2.4 series kernel by default. (I tried 2.6 a couple of times, but never had much luck.) I decided to take a few hours out over a weekend and see if I couldn't solve this minor problem in an elegant way that would end my headaches in this regard.

I have almost completed a script that will allow you to mount a set node for each physical USB mass storage device you have. For example, say you have 3 flash drives - 1 gig, 2 gig, and 4 gig in size. On a system with my script running, one can mount /dev/2gig and it works if the 2 gig drive is plugged in, just as mount /dev/1gig will work if the 1 gig drive is plugged in. These nodes persist after a reboot or unloading/reloading of the usb-storage module. If you've never had your 4 gig drive in, you plug it in, run a script as root, and you're good to go from that time forward for that specific 4 gig drive. I have had this working on my system at work (Slackware 10.2) 24/7 for a few months now, which indicates to me that it's stable enough to start telling people about.

While I still have to polish it and add a few checks for stupid things (which I'm sure people will try ), I'd like to share this with the world at large. However, I do have a few questions. I've always wanted to contribute something to the Linux/Open-Source community, but have never known what to work on or where to start before. I despise C/C++, but am a good programmer and can 'think outside the box' when it comes to a lot of things. Now that I have something that I think would be of use to people, I really don't know where to go from here.

Should I create a SourceForge page for it or get in contact with somebody specific to host it? (I don't have my own web page.) Should I find a free web hosting provider and code up some html and host it that way? Given the above comments about 2.4 vs 2.6, should I e-mail somebody at Slackware or a kernel guy directly?

How do I go about licensing it so that my name stays on it, the documentation stays relatively intact, and that people don't go around selling it? (Hey, if you want to sell it, great - just give me the money! ) I also don't want to be sued if somebody thinks it destroyed their machine, causes the earth's axis to shift, or space aliens to molest their cat...

Is something like this even wanted by anybody? I'm assuming it would be useful since I was fighting with it on my systems, but I realize that I could be in the definite minority here.


Any advice would be appreciated. Thanks in advance!
 
Old 04-24-2007, 09:34 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by Ruler2112
I found quite a few threads that discussed the problem and supposedly udev does something like this in the 2.6 series kernels, but is complex, slow, and buggy from the reports I've seen.
While I applaud your willingness to reinvent the wheel, I might comment that udev is neither slow nor buggy. It may have been complex before, but without dependence on hotplug, it really is a cinch (and persistent device naming is one of the things udev was made for).
 
Old 04-24-2007, 09:54 PM   #3
Ruler2112
Member
 
Registered: Oct 2004
Location: Michigan, US
Distribution: Redhat 7.3, 9.0; Slackware 10, 10.1, 10.2, 11; FreeBSD 7.0; KnoppMyth 5.5
Posts: 125

Original Poster
Rep: Reputation: 16
I saw numerous reports of people having problems with udev while trying to find a ready-made solution to this. I myself know that if I install 2.6.i_forget on a slackware box, it no longer automatically creates /dev/md0 for my software RAID. Figuring out the right major/minor nodes and then inserting a mknod command in /etc/rc.d/rc.local is something that was over my head at the time and took me several hours to figure out why the stinkin RAID wouldn't mount.

I'm not trying to be down on udev - my experience with it is admittedly limited - but why would they make it 2.6 only? Like I said in my original message, it took me a few hours to hack together something that works perfectly under 2.4.

Would I be correct in assuming that your response indicates a 'no' answer for the last question in my original post?
 
Old 04-25-2007, 10:32 AM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by Ruler2112
Would I be correct in assuming that your response indicates a 'no' answer for the last question in my original post?
My answer to the question “Is something like this even wanted by anybody?” is yes, many people wanted something like this — and that’s why they use udev…

As for 2.4 vs. 2.6, this was one of the improvements created specifically in linux-2.6. While I’m not putting down your script, udev has a lot more features than persistent device naming (in fact, its purpose was to replace that abomination they call devfs). While udev itself is in userspace, the messages for each device node are sent from the kernel.

Btw., I didn’t quite understand this bit:
Quote:
Originally Posted by Ruler2112
I myself know that if I install 2.6.i_forget on a slackware box, it no longer automatically creates /dev/md0 for my software RAID. Figuring out the right major/minor nodes and then inserting a mknod command in /etc/rc.d/rc.local is something that was over my head at the time and took me several hours to figure out why the stinkin RAID wouldn't mount.
udev is supposed to do this for you. Perhaps you didn’t install it.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Drive - Static /dev/sdx Nodes in 2.4.x? Ruler2112 Linux - Hardware 1 01-26-2007 10:20 AM
Mounting usb devices under 2.4.x kernels - /dev nodes and mountpoints alienDog Linux - General 0 10-28-2005 08:29 AM
anybody still using static dev nodes? garba Linux - General 7 09-08-2005 07:21 PM
missing /dev/i2c nodes puremourning Linux - Software 0 02-23-2005 09:10 PM
missing nodes in /dev with 2.6.5 d3c3it Debian 2 04-18-2004 02:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:05 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