Data Management

Use Amd to automount NFS shares

If you need a program to automount remote filesystems, Vincent Danen has a recommendation for you: the BSD Amd suite. Read this tip to get started.

Using networked filesystems is very commonplace, be it NFS or Samba. For most people with Linux networks, NFS is the more popular. Those with mixed environments tend towards using Samba to share files with the Windows crowd, and may even use NFS at the same time to share files with Linux and other UNIX users.

Typically, NFS mounts are handled statically, but this isn't always optimal, so there are two programs for Linux that allow for on-demand or "auto" mounting of remote filesystems: AutoFS and the BSD Amd suite.

Nearly all Linux distributions provide BSD Amd, so it should be a simple urpmi or apt-get away. To get started, simply install the amd or am-utils package.

The first step is to configure amd by editing /etc/amd.conf. This file contains a variety of options with sensible defaults. The [global] section deals with options for the amd daemon itself. The rest are definable mount-points. Most distributions have [/net] pre-defined, which points to the configuration file /etc/ This file defines network-based remote filesystems, or remote NFS exports.

The /etc/ file is fairly generic and provides some default options. Use it to tweak NFS mount options like the read and write sizes.

Once you've started amd, you can begin to use it without any further configuration. If you have a system on the local network that provides NFS exports, you can immediately access it. Let's say, for example, the server is and the exported directory you are interested in is /files; you would use:

$ cd /net/

Amd will automount /files on the moment you change to the directory. If you want to use something more memorable, feel free to symlink the directory elsewhere:

$ cd ~/
$ ln -s /net/ .

Now when you cd ~/files/, the remote NFS export will automatically mount, and you can access the files immediately. Depending on the export options, you may have read-only access or you may be able to read and write to the files on the share.

Amd is extremely easy to use with minimal configuration required. In most cases, it works perfectly out of the box.

Delivered each Tuesday, TechRepublic's free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!


Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.


A bit of an explanation of the relative merits of amd and autofs would be worthwhile. I have used autofs for some time, so why would I want to switch to amd? What is its advantage over autofs?

Neon Samurai
Neon Samurai

You gotta know when your beat and after days of reading HOWTO documents and mucking with AutoFS on a test machine; I'm beat. I'm sure I'll be back at it (I can't leave a tech puzzle alone) again next week but currently the only related command that seems to actually work is "urpme autofs; rm -rf /etc/autofs" All I want to do is set my samba mounts to automount when needed and disconnect after a delay so my NAS isn't constantly being spun up. Sidenote: Mandriva does not apear to have AMD in it's repositories. I'm looking into automount as a solution until I figure out this AutoFS puzzle.

Neon Samurai
Neon Samurai

A comparison of the two would have been of benifit but in my case, I'm deciding between the two without a previous install. AMD looks pretty easy to configure but that's without an equivalent howto for AutoFS for comparison. On that note, anyone have a five steps Howto on AutoFS handy? I'm also guessing I'll be able to AutoFS mount to my normal /mnt path but that's more personal speculation. Either way, this solves one of my issues at home. My NAS box won't sleep when any of the *nix machines are on because I've mounted it staticly through fstab/mtab.


You can install amd on Mandriva via contribs. It's not in main. And the tip on autofs is noted... expect that in the future!

Neon Samurai
Neon Samurai

I'll have to give AMD a go on the VM testbed. "urpmi amd" and searching "amd" through rpmdrake where unsuccessful but I'll definately try again after confirming that the contrib repository is setup.