automounting USB Flash Drive
I'm wondering if anyone has tackled the issue of having a USB flash drive automatically mount to the file system when it is inserted? I am working on a TI DM355 DaVinci EVM board running MontaVista Linux 4.0.1.
I can do this manually easily enough by: mkdir /mnt/usbflash mount /dev/sda1 /mnt/usbflash To make this mount occur automatically, I *think* that I need to use autofs to do this, but if that's wrong I'd like to know. Using autofs, here is what I did... I inserted the following into /etc/auto.master: /mnt/usbflash /etc/auto.usbflash --timeout=30 --ghost I inserted the following into /etc/auto.usbflash: usbflash -fstype=auto,sync :/dev/sda1 I then: mkdir /mnt/usbflash /etc/init.d/autofs restart and this appeared to work. But for some reason, the directory /mnt/usbflash was mysteriously deleted. And inserting the USB stick does not force an automatic mount. Any suggestions? Thanks in advance. |
You might want to explore udev as well...
|
I am not sure about MontaVista, but normally all these stuff is in /etc/fstabs.
|
What is kernel version of MontaVista Linux 4.0.1?
|
Kernel Version
The kernel version is 2.6.10.
|
im not sure if this is elegant but you can waste negligible processor cycles by doing something like:
[untested] Code:
while [ 1 ] |
|
You can download a program called automount and this program will automatically mount a usb flsh drive for you without any edit of /etc/fstab or script.
|
Quote:
Code:
while [ 1 ] |
If you have udev, you could use something like this:
Code:
KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="usb%m", GROUP="users", OPTIONS="last_rule" |
udev is the best approach
Depends on your version of Montavista but 5.0 has udev support and as people have contributed above this is the best way.
|
All times are GMT -5. The time now is 09:39 AM. |