[Techtalk] finding labels for mount or fstab for USB devices

R. Daneel Olivaw linuxchix at r-daneel.com
Mon Feb 16 03:27:46 EST 2004


Hi there,

> I was wondering what sort of /dev files USB storage devices get
> parked under.
> Do they always go under /dev/sd*? How do you find out? Output
> samples welcome. :)

What happens at home (slack 8.1, kernel 2.4.18):
I plug in my USB wristwatch (well, I just had to tell it :p) and it gets
some sort of ID.
here what my /etc/var/messages looks like :
<snip>
Feb 15 15:00:04 trantor kernel: hub.c: USB new device connect on bus1/1,
assigned device number 3
Feb 15 15:00:04 trantor kernel: scsi1 : SCSI emulation for USB Mass
Storage devices 
</snip>
and here what dmesg tells me :
<snip>
USB Mass Storage device found at 3
VFS: Disk change detected on device sd(8,1)
SCSI device sda: 256000 512-byte hdwr sectors (131 MB)
sda: Write Protect is off
 sda: sda1
MSDOS FS: IO charset iso8859-1
</snip>
So this means, I will be able to access /dev/sda1 (scsi emulation) for
an USB device having the id "3".
(I forced iso8859-1 charset mapping in /etc/fstab, this seems to be
guessed from there, as I think the system is unable to guess otherwise)
Now If I disconnect that usb mass storage device, then replug it, I'll
get a new id (say 4) and so on. I will still be able to access it
through /dev/sda1 (kernel kindly shows me what partitions I can access).
Now, I plug in my i-River mp3/ogg player (external hardisk) also on usb.
I will get a new id (as usual) BUT I will get access to it through sdb1.
Order is very important here. As already written, unloading & reloading
the usb mass storage kernel module intializes the whole thing. If I
start plugging the i-River, unplug it and plug my usb wristwatch, I get
a reversed order. Therefore, I have set up both sda1 & sdb1 in
my /etc/fstab so I can mount both from a user login (option 'user' in
fstab) depending on plugging order. I still do not fully understand why
this is that way, but well ... I think, knoppix CD's are a lot smarter :
they show a mount icon everytime a new device is connected, and then the
problem doesn't show. I however user neither knoppix on my PC (Slackware
!!!) nor KDE desktop (mine is the old fashoned Gnome 1.4 !!!) so I
cannot tell if this is just some log picking or any hotplug manager
thing.

What I've been thinking of, was that IF usb storage devices held
ext2/ext3 partitions (actually, they are fat16/fat32 for winblows
compatibility & internal readability for the i-River) they should be
able to mount partitons according to partition labelling (have a look at
redhat's fstab layout) and escape that tricky partion numbering puzzle.

Now, well, I guess I didn't help alot, but I hope it explained a bit
more how this seems to work ;) (I hope they have better ways in 2.6
kernel series).

bye,

R. Daneel Olivaw,
The Robot Inside.


More information about the Techtalk mailing list