Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
USB Flash drive
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
DaGr8Gatzby
n00b
n00b


Joined: 18 Sep 2004
Posts: 40

PostPosted: Thu Nov 04, 2004 6:49 pm    Post subject: USB Flash drive Reply with quote

I can get mine to work. I do have SCSI enabled and it seems to work fine. The thing is in my fstab file, I have a line that has it to mount the drive. However, it becomes pointless because when I first plug in the keychain it appears as /dev/sdab and /dev/sdb1. here is the exact line in my fstab

Code:

/dev/sdb1               /mnt/keychain   vfat,ext3       defaults,noauto,sync,users      0 0


Obviously that line works. I'm not complaining. But then lets say I remove the device. I leave for work or whatever. I then come back and plug it back in and the device it shows is /dev/sdc and /dev/sdc1. Is there a workaround for this?
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6069
Location: Removed by Neddy

PostPosted: Thu Nov 04, 2004 7:13 pm    Post subject: Reply with quote

yes there is!!!

sounds like you are using devfs or a static dev.

This is why devFS was dropped. for dynamic devices there was no way of conveniently tying a /dev entry to a particular device.

udev solves this problem by allow user rules (for the creation of /dev nodes) to be written


This is my user udev rule:

Code:

jrb@Fluid ~ $ cat /etc/udev/rules.d/10-local.rules
############################
# Local Machine Udev rules #
############################

BUS="scsi", KERNEL="sd*", SYSFS(serial)="B8177840FE1CB499", NAME="%k", SYMLINK="usbkey"

BUS="usb", SYSFS{serial}="509DLT", NAME="usb/%k", SYMLINK="canon_i550"

KERNEL="mice",          NAME="input/%k", SYMLINK="usbmouse"
KERNEL="js*",           NAME="input/%k", SYMLINK="%k"



As you can see from this it creates (based on my USB sticks serial number, udev has a prog to find this out) a device called "sd*" so this could be sda1, sdb2.... BUT it also makes a symlink called "usbkey", this will always be linked to the correct /dev entry, since it is created at the creation of /dev/sd*

I also have an entry for the creationof my USB printer to produce a more convineient name.

Final two are just house keeping for two nodes that are created and I wnat more useful symlinks.

Have fun
Back to top
View user's profile Send private message
Bepcyc
Tux's lil' helper
Tux's lil' helper


Joined: 07 May 2004
Posts: 130
Location: Moscow, Russia

PostPosted: Thu Nov 04, 2004 7:22 pm    Post subject: Reply with quote

Use udev, here's a line I added to my /etc/udev/rules.d/50-udev.rules:
Quote:

KERNEL="sd[a-e][1-9]" NAME="%k" SYMLINK="flash/flash%e"

Now I see first flash as /dev/flash/flash, second as /dev/flash/flash1 etc.

If you want to see the device file for current flash unchangeable that try to use the sysfs advantages
For example, this is how I made the link for my cdrom
Quote:

BUS="scsi", SYSFS{vendor}="QSI", SYSFS{model}="CDRW/DVD SBW-242", SYMLINK="cdrom"

It's not difficult to change it for your flash drive, just explore the sysfs ;)

it may be also useful fot you to look for
Quote:
man udev


Guess, you found the answer to your question
Back to top
View user's profile Send private message
DaGr8Gatzby
n00b
n00b


Joined: 18 Sep 2004
Posts: 40

PostPosted: Fri Nov 05, 2004 7:28 pm    Post subject: Reply with quote

I got it guys....thanks for all your help. I kind of had a little trouble with Udev but I worked at it. And also at first my rule wasn't working for my keychain. But I just added the KERNEL=sd* option and it worked. Thanks. Sorry if that was a newbie question I'm coming from FreeBSD.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum