Auto-Mount Daemon (amd)


Auto-Mount Daemon (amd)

The auto-mount daemon, amd, makes NFS mounts even more convenient. This daemon allows you to mount NFS shares (and other filesystem types, as a matter of fact) dynamically, simply by working in the directory in which the share would be mounted, without ever having to bother with mount commands.

FreeBSD provides a basic way to set up amd. Simply add the following line to /etc/rc.conf:

amd_enable="YES"


When the system is booted with this option, amd runs with the options specified in the amd_flags setting, which are such that anything in the /host or /net directoriesboth of which are created automatically by amdwill auto-mount by name. You can also start it in the same way as it would be at boot time by issuing the /etc/rc.d/amd start command.

With amd running, use the cd command to move into the /host directory. Look around, and you'll notice the directory is empty:

# cd /host # ls #


However, try listing by name as if there were a directory there with the same name as a known NFS server on the network:

# ls stripes home


So, it seems that there's indeed a directory called stripes in the /host directory, and inside it is a home directorywhich contains everything that the stripes:/home share has. You've just auto-mounted that share into the /host directory, simply by listing it as a directory name. /host/stripes/home is functionally the same thing as the /home2 mount point you manually created in the earlier example. The df command will verify it:

# df Filesystem    1K-blocks     Used    Avail Capacity  Mounted on stripes:/home   9924475  1642345  7488172   18%     /.amd_mnt/stripes/host/home


Note

Notice that NFS shares mounted in this manner actually appear to be mounted inside a directory called .amd_mnt in the root directory. This directory doesn't actually exist; it's just a type of shorthand used by the amd daemon for bookkeeping purposes.


To specify a permanent location for a mountable NFS resource, simply make a symbolic link to the appropriate path within /host or /net:

# ln -s /home2 /host/stripes/home


From now on, whenever you go into the /home2 directory, the stripes:/home share will automatically mount and give you access to its files. When the share is no longer in use, it will automatically unmount.

Tip

You can specify much more complex amd mount maps, which are more direct methods of mounting filesystems at particular points, with the /etc/amd.conf file. This file doesn't exist in the default FreeBSD installation; see man amd.conf for details on its format and capabilities.





FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net