====== Automatically mount the external USB drives at the same mount point when plugged in ======
Generic description:
Finally found a solution on how to make my Linux (Debian):
A) Remember the unique USB drive(in my case a Western Digital Mirror Edition), and where to mount it
B) Automatically mount it when connected
First you have to identify your usb drive, make sure it is connected and you know the device name, in my case:
NoMore:/home# blkid /dev/sdc1
/dev/sdc1: UUID="6494BFE994BFBC3C" LABEL="My Book" TYPE="ntfs"
NoMore:/home#
As you see my drive has a unique ID. This is what we are gonna use in fstab instead of the device name. Smart huh? :) This way we avoid the problem of changing device names when plugging stuff in and out.
Next in fstab, make a line like this:
UUID=6494BFE994BFBC3C /home/user/DiSK/ ntfs-3g defaults,auto,umask=000,users,rw 0 0
Make the changes you need, but make sure you use your correct UUID(and remove the "") and it is set auto like above.
Next check if it works by typing:
mount -a -no-canonicalize
The -a parameter means it shall mount everything set to auto in fstab. If it works, umount your drive and let's continue:
The -no-canonicalize prevents mounting an already existing mount point again over itself (cifs)
Ok, make sure you got udev installed. This is what's gonna automaticly mount our drives when new ones are detected. Make a new file;
NoMore:/home# nano /etc/udev/rules.d/99-mount.rules
And add the following line:
SUBSYSTEM=="block", RUN+="/bin/mount -a -no-canonicalize"
Just make sure it uses the correct path to the mount command.
Next restart udev:
NoMore:/home# /etc/init.d/udev restart
Now unmount(umount) your drive, unplug it and try it out.