autofs-5.1.9

Autofs の概要

Autofs controls the operation of the automount daemons. The automount daemons automatically mount filesystems when they are accessed and unmount them after a period of inactivity. This is done based on a set of pre-configured maps.

[注記]

注記

LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS 開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。

パッケージ情報

Autofs の依存パッケージ

必須

libtirpc-1.3.4, rpcsvc-proto-1.4.4

任意

nfs-utils-2.6.4, libnsl-2.0.1, libxml2-2.12.3, MIT Kerberos V5-1.21.2, OpenLDAP-2.6.6 (クライアントのみ), Cyrus SASL-2.1.28

カーネルの設定

カーネルにて自動マウント (automaounter) サポートが有効になっていることを確認してください。

File systems --->
  <*/M> Kernel automounter support (supports v3, v4 and v5)          [AUTOFS_FS]

任意の設定として、カーネル設定にて以下のオプションを有効にします。

File systems --->
  [*] Network File Systems --->                            [NETWORK_FILESYSTEMS]
    <*/M> NFS client support                                            [NFS_FS]
    <*/M> SMB3 and CIFS support (advanced network filesystem)             [CIFS]

必要な場合は、カーネルを再コンパイル、再インストールします。

Autofs のインストール

以下のコマンドを実行して Autofs をビルドします。

./configure --prefix=/usr             \
            --with-mapdir=/etc/autofs \
            --with-libtirpc           \
            --with-systemd            \
            --without-openldap        \
            --mandir=/usr/share/man   &&
make

このパッケージにテストスイートはありません。

root ユーザーになって以下を実行します。

make install
[注意]

注意

If autofs is already installed on your system, be sure to backup your configuration files. They'll be overwritten by the following command.

Install the default configuration files, still as the root user:

make install_samples

コマンド説明

--with-libtirpc: This switch forces the package to use libtirpc for RPC functionality instead of relying on implementation from Glibc, which was removed in LFS 8.1.

--with-systemd: This switch enables installation of the bundled systemd units.

--without-openldap: This switch disables openldap if found. If openldap is desired, omit this switch. Note that openldap support in autofs requires MIT Kerberos V5-1.21.2.

Autofs の設定

設定ファイル

/etc/sysconfig/autofs.conf, /etc/autofs/auto.master, /etc/autofs/auto.misc, /etc/autofs/auto.net

設定情報

The installation process creates auto.master, auto.misc, auto.smb, and auto.net. Replace the auto.master file with the following commands as the root user:

mv /etc/autofs/auto.master /etc/autofs/auto.master.bak &&
cat > /etc/autofs/auto.master << "EOF"
# Begin /etc/autofs/auto.master

/media/auto  /etc/autofs/auto.misc  --ghost
#/home        /etc/autofs/auto.home

# End /etc/autofs/auto.master
EOF

This file creates a new media directory, /media/auto that will overlay any existing directory of the same name. In this example, the file, /etc/autofs/auto.misc, has a line:

cd   -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

that will mount a cdrom as /media/auto/cd if that directory is accessed. The --ghost option tells the automounter to create ghost versions (i.e. empty directories) of all the mount points listed in the configuration file regardless whether any of the file systems are actually mounted or not. This is very convenient and highly recommended, because it will show you the available auto-mountable file systems as existing directories, even when their file systems aren't currently mounted. Without the --ghost option, you'll have to remember the names of the directories. As soon as you try to access one of them, the directory will be created and the file system will be mounted. When the file system gets unmounted again, the directory is destroyed too, unless the --ghost option was given.

[注記]

注記

An alternative method would be to specify another automount location such as /var/lib/auto/cdrom and create a symbolic link from /media/cdrom to the automount location.

The auto.misc file must be configured to your working hardware. The loaded configuration file should load your cdrom if /dev/cdrom is active or it can be edited to match your device setup. Examples for floppies are available in the file and easily activated. Documentation for this file is available using the man 5 autofs command.

In the second line, if enabled, a user's home directory would be mounted via NFS upon login. The /etc/home.auto would need to exist and have an entry similar to:

joe  example.org:/export/home/joe

where the directory /export/home/joe is exported via NFS from the system example.org. NFS shares are covered on the next page.

This package could also be used to mount SMB shares, however that feature is not configured in these instructions. For additional configuration information, see the man pages for auto.master(5). There are also web resources such as this AUTOFS HOWTO available.

Systemd ユニット

To start Autofs at boot, enable the previously installed systemd unit by running the following command as the root user:

systemctl enable autofs
[注記]

注記

You can also specify OPTIONS variable in the /etc/sysconfig/autofs file with any additional parameters that you might want to pass to the automount daemon.

パッケージ構成

インストールプログラム: automount
インストールライブラリ: libautofs.so. lookup_dir.so, lookup_file.so, lookup_files.so (symlink to lookup_file.so), lookup_hosts.so, lookup_ldap.so (optional), lookup_multi.so, lookup_nis.so (symlink to lookup_yp.so), lookup_program.so, lookup_userhome.so, lookup_yp.so, mount_afs.so, mount_autofs.so, mount_bind.so, mount_changer.so, mount_ext2.so, mount_ext3.so (symlink to mount_ext2.so), mount_ext4.so (symlink to mount_ext2.so), mount_generic.so, mount_nfs.so, mount_nfs4.so (symlink to mount_nfs.so), parse_amd.so, parse_sun.so
インストールディレクトリ: /usr/lib/autofs, /etc/autofs

概略説明

automount

is the daemon that performs the mounting when a request is made for the device