2

I've installed autofs package, and I know /etc/auto.master and /etc/auto.misc . I set only one monitored path in /etc/auto.master:

/root/media /etc/auto.misc

Then I set usb sub-directory setting in /etc/auto.misc:

usb -fstype=auto,sync,nosuid,rw,gid=100,umask=000 :/dev/sdb1

I'm very sured that if I insert usbstick into system, it always in /dev/sdb and only one partition in FAT32 will be shown in /dev/sdb1.

And finally I restart autofs service certainly. But I just can't find anything in /root/media after I insert my usbstick.

There isn't /root/media pre-built, and I can found /root/media be built after I restart autofs service by executing /etc/init.d/autofs restart. Incidentally, I tried /etc/init.d/autofs reload already, and got a useless same result.

Anybody knows where is the problem?

1 Answer 1

1

There's an easier way, here's what I use. It's only good if you mount to the same mount point every time.

in /etc/udev/rules.d make a new file called automount.rules and put the following in it:

ACTION=="add",KERNEL=="sdb*", RUN+="/bin/mount /usb"
ACTION=="remove", KERNEL=="sdb*", RUN+="/bin/umount /usb"

in /etc/fstab put the following:

/dev/sdb1 /usb auto rw,user,noauto,noatime,umask=000

Then run this: udevadm control --reload-rules

Now every time you insert any usb device it will be mounted on /usb. If this is not what you want to happen then you'll have to find something else.. But it works for me.

1
  • I tried your solution, but it isn't worked. Maybe it is because that our system shut the hot-plug function down in kernel. So I will try script method to archive it.
    – naive231
    Mar 14, 2013 at 5:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .