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!

About Vincent Danen

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.

Editor's Picks

Free Newsletters, In your Inbox