LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-26-2007, 10:17 AM   #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
Question USB Drive - Static /dev/sdx Nodes in 2.4.x?


I use Slackware with 2.4.x kernels on most of my machines for it's rock solid stability. I've run into a nuisance that I feel should be easy enough to solve, although I've googled and not found any solutions to the problem.


The Problem:

When I plug in my flash drive, the kernel assigns a node in /dev to interface with the drive as a scsi disk, let's say /dev/sda for example. At some later time, I plug in my digital camera, which is also a mass storage device. The kernel assigns the next sdx node, say /dev/sdb. After this, I plug in my SD card reader, which is assigned /dev/sdc.

This is all well and good. It's also nice that the kernel remembers which device goes with which node, because if I plug in my flash drive again, it's again given /dev/sda. The problem comes when I reboot my machine, or even just unload the usb-storage module and modprobe it in again. Instead of the flash drive continuing to be assigned /dev/sda, it's assigned a node in whatever order it was plugged in. In other words, if I take the steps in the paragraph above, then reload the usb-storage module and plug in my card reader, THAT is now /dev/sda.

I'd like to change this.


The Solution:

I worked up a hack to trick the machine into assigning the SAME node to each specific device every time it's plugged in. I even wrote a script and have things mostly working. I did run into a roadblock though.

/var/log/syslog is written to with information about the device when a drive is first plugged in, but not on subsequent plug-ins. /var/log/messages does not either. lsusb -v shows a ton of information about connected devices, some of which I plan on using. I have the bus ID and device ID of the mass storage device that was connected, but need some way of determining which /dev/sdx node was assigned to it.

Like I said above, I *know* the kernel remembers this information somehow, as the same /dev/sdx node is assigned to each specific device every time it's plugged in. I just need some way of finding out what node was assigned to a device at a given bus and device ID.


udev:

I know that many of you are going to say that udev has this capability and that I should just upgrade to a 2.6.x kernel. I do have my reasons for staying with 2.4.x though. First, I know from experience that udev does not detect RAID arrays automatically as 2.4.x does. (Took me several hours of swearing and finally manually creating /dev/md0 in rc.local using mknod to figure that one out!)

I've also read comments online from many people that indicate to me that udev is not as stable as it should be. I use linux because I hate having computer problems; if I want to run my machine for 6 months, then it should run for 6 months without a problem. My servers are even more critical - one of them goes down, our $20,000 security system could be rendered useless or many people would be unable to work until I get it fixed. Linux is wonderful for these applications and I don't want to risk instabilities by migrating to a new kernel prematurely. (I've yet to find any compelling reason to go to 2.6.x yet anyways.)

I also have some applications written in Kylix, which last time I checked, will only run on 2.4.x kernels.


Conclusion:

If anybody knows of a program I could call and pass the bus/device id of a usb device and have the specific /dev/sdx node that was allocated for it, I'd be grateful. The project isn't dead without it, but is going to take a LOT more work to find a roundabout way to determine this information.

I am planning on starting a SourceForge page for this once I get something functional, but have never done one before and don't want to post stuff for people to rip apart until I get something working.
 
Old 01-26-2007, 10:20 AM   #2
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
BTW, I've poked around in the usb source files and found that the maintainer listed is Matthew Dharm. I tried e-mailing him, but the e-mail came back as undeliverable. I went to the domain listed and e-mailed the professor who had Matthew as a student, but he has lost touch with him since the site was updated and does not know how to get in contact with him.
 
  


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
USB drive... /dev/sda1 doesn't show unless I try mounting /dev/sda as vfat finite Linux - Hardware 8 03-10-2009 12:52 AM
Lock different external drives to a set device name ? (/dev/sdX) Dark Carnival Linux - Hardware 5 10-20-2006 10:42 PM
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
new SDX-500 tape drive: DOA or me? bdp Linux - Hardware 2 11-07-2004 01:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:07 AM.

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