linux:automount
Automount
Automount has a lot of features and advantages. On my system I use automount for an USB hard drive which I use for daily backups.
However if I use fstab I need to unmount the drive if I want to connect the drive to another computer or just messing around with cables. With automount the drive is automounted when need and quickly umounted when not needed.
You can read more on other configuration examples at debian wiki.
To setup automount on Debian first edit nsswitch.conf by adding the following line. This is a minor bug in debian squeeze.
automount: files
nsswitch.conf should look something like this.
passwd: compat group: compat shadow: compat hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 wins networks: files automount: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis
next install autofs by using apt.
$ apt-get install autofs
add to /etc/auto.master
/mnt/auto /etc/auto.hdbackup --timeout 5
create a new file /etc/auto.hdbackup
bkhd1 -fstype=auto UUID=53dcfd97-3c13-4b37-b4fe-df926cc0a58c <file> Create the directory auto in mnt and restart autofs <file> $ mkdir /mnt/auto $ /etc/init.d/autofs restart
To test if it works cd to /mnt/auto/bkhd1
As you quickly will notice is the directory bkhd1 will disapear when the timeout has reached. Make a symlink and use it instead to avoid confusion.
$ cd /mnt $ ln -s /mnt/auto/bkhd1 usbhd1