-   Linux - Hardware (
-   -   confusion on automount of USB pen drive with hotplug (

krmane 07-12-2006 04:01 PM

confusion on automount of USB pen drive with hotplug
I have a generic hotplug problem which mostly a newbee to this concept might ask.
I want to do the following.
1. let hotplug (udev) detect which USB pen drive has been connected and create a device entry for the same.
2. create a script for the hotplug event to mount that pen drive on /mnt/usb and fire the ls command.
so is this possible and any hints how?
I have all settings made in the /etc/fstab to load the /dev/sda1 to /mnt/usb as I am sure that my pen drive is being detected as /dev/sda1 and I have used the noauto parameter as well.
umask is 022 so all the settings are there.
only I want to mount any device that is detected as /dev/sda1 and list its contents.
Please help and I will appreciate an example that does exactly what I mentioned.

rkelsen 07-12-2006 07:47 PM

First and foremost, you need a 2.6 series kernel.

Second, udev must be installed and running. If you don't see the appropriate entry appearing under /dev, then you have mis-configured something. Your kernel must support SCSI in order for USB storage devices to work properly.

Now, with those two items correctly configured, you can automate the mounting of attached USB storage devices with a package called usb-mount:
This is basically a set of scripts which are installed under /etc. I was able to get it working under Slackware pretty easily. It enables you to run whatever command you wish upon insertion or removal of a USB storage device. Using this package, you don't need entries in /etc/fstab for any USB storage devices.

All times are GMT -5. The time now is 03:00 PM.