View previous topic :: View next topic |
Author |
Message |
Spida Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 08 Feb 2003 Posts: 97 Location: Germany
|
Posted: Sun Aug 22, 2004 4:34 pm Post subject: mount usbsticks automatically to different mountpoints? |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Coogee Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/821049054431061fb5ceaa.jpg)
Joined: 23 Apr 2002 Posts: 184 Location: E.U.
|
Posted: Sun Aug 22, 2004 7:41 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Spida Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 08 Feb 2003 Posts: 97 Location: Germany
|
Posted: Fri Aug 27, 2004 3:02 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
GatoVolador Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/12605209844187cadb0f9d6.jpg)
Joined: 16 Jun 2004 Posts: 268 Location: California, USA
|
Posted: Fri Aug 27, 2004 4:39 pm Post subject: |
|
|
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 |
|
![](templates/gentoo/images/spacer.gif) |
Nate_S Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Monkey Island/Monkey_Island_-_Monkey.gif)
Joined: 18 Mar 2004 Posts: 414
|
Posted: Fri Aug 27, 2004 6:11 pm Post subject: |
|
|
udevinfo, which comes with udev, will give you the info.
Also, for auto mounting, do a search for ivman |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|