Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mount usbsticks automatically to different mountpoints?
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
Spida
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2003
Posts: 97
Location: Germany

PostPosted: Sun Aug 22, 2004 4:34 pm    Post subject: mount usbsticks automatically to different mountpoints? Reply with quote

Is it possible to mount different usbsticks automatically on insertion to different mountpoints?
I'd like to have my mp3-player-usb-stick at /mnt/mp3playerstick, another stick at /mnt/128mbstick and the big one to /mnt/512mbstick.
Do I need udev for this, or can it be done with devfs?
Back to top
View user's profile Send private message
Coogee
Apprentice
Apprentice


Joined: 23 Apr 2002
Posts: 184
Location: E.U.

PostPosted: Sun Aug 22, 2004 7:41 pm    Post subject: Reply with quote

With devfs check this topic: https://forums.gentoo.org/viewtopic.php?t=118474

With udev it is quite simple.
Just add a line like the following to udev.rules:
Code:

BUS="scsi", KERNEL="sd*", SYSFS{model}=" USB Drive", NAME="%k", SYMLINK="memstick"

The "*" in "sd*" is correct.
The model name can be found in /sys/block/sdx/device/model.
Back to top
View user's profile Send private message
Spida
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2003
Posts: 97
Location: Germany

PostPosted: Fri Aug 27, 2004 3:02 pm    Post subject: Reply with quote

so that udev bits you pasted would link the /dev/sdxy where a usb-stick with the model name " USB Drive" is connected, to /dev/memstick, did I understand that right? what happens if I have two usbsticks that have the same model name?
Back to top
View user's profile Send private message
GatoVolador
Apprentice
Apprentice


Joined: 16 Jun 2004
Posts: 268
Location: California, USA

PostPosted: Fri Aug 27, 2004 4:39 pm    Post subject: Reply with quote

You can do device matching through a number of mechanisms, not just the model name. For example, you can match devices based on their serial number, which, I imagine, would solve your problem. To wit:
Code:
BUS="scsi", KERNEL="sd*", SYSFS{serial}="<device serial number here>", NAME="%k", SYMLINK="memstick"


What if you somehow have two devices with the same serial? (What are the odds there?) You can use any number of keys to specify a device. For example, you could add SYSFS{model}="xxxx" to the above line to match both the serial number and model.

A good reference is at Writing udev rules. I believe there is a link to a script that allows you to get all the SYSFS info about your devices at Decibel's UDEV Setup (look for udevread.py.)

Regards,
Jay
Back to top
View user's profile Send private message
Nate_S
Guru
Guru


Joined: 18 Mar 2004
Posts: 414

PostPosted: Fri Aug 27, 2004 6:11 pm    Post subject: Reply with quote

udevinfo, which comes with udev, will give you the info.

Also, for auto mounting, do a search for ivman
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