September 25, 2010

AutoFS - Auto-Mount of Hard Drives

« How to embed Jetty Server | Main | OpenID Tutorial and Java Implementations »

I have an external USB drive, which interacts as my backup and media file system. Very often I switch off this hard drive, because of energy savings. But after enabling I have to mount manually this drive. Furthermore my Samba server access to that and from my other Linux working stations I also have to manually mount the Samba accounts. After sometime I was really nerved. That's why I tried to add the USB drive and my Samba accounts to the fstab files. But after a switch off the USB drive they wasn't be reconnected. So I looked for another solution and I found one. The AutoFS daemon solved my problem. Below I describe how to install and configure the AutoFS feature. It's very easy.

First you have to install the autofs package (e.g. Ubuntu):

sudo apt-get install autofs

Second you edit the /etc/auto.master file:

# absolute directory for mounting and 
# dedicated configuration file path
/media  /etc/autofs/auto.media  --timeout=5

Last you add your USB drive to the auto.media file:

# relative mount directory, file system type, further options
# dev path
BackupAndFiles  -fstype=ext3,rw,nosuid,nodev,uhelper=udisks  :/dev/sdb1

That's all. The same way works for another file systems.

Regards
Rafael Sobek

Technorati Tags:

Posted by rafael.sobek at 10:58 AM in Linux

 

[Trackback URL for this entry]

Comment: Kostis at Di, 28 Sep 7:35 AM

Just install dbus/hal and you do not need to ever automount anything again

Your comment:

(not displayed)
 
 
 

Live Comment Preview: