Solaris am-utils 設定

このページでは、am-utils のインストールと設定についてまとめる。

NFS サーバが別の NFS サーバのファイルシステムをマウントすること(クロスマウント)がある(メールサーバ、Web サーバなど)。このとき、自動マウンタとして am-utils の amd を使う方法がある。

参考 Web ページ:

手順:

最新の安定版は am-utils 6.2 である。次の手順でソースを取得し、ビルドしてインストールする。

cd /tmp
wget https://download.filesystems.org/am-utils/am-utils.tar.gz
gzip -cd am-utils.tar.gz | tar xvf -
cd am-utils-6.2
./configure
make CC=gcc CFLAGS="-O2 -D_LARGEFILE64_SOURCE"
su
make install
exit

既定では、amd は /usr/local/sbin/amd にインストールされる。

/etc/rc2.d/S77amd の作成

次の内容のファイルを /etc/rc2.d/S77amd として作成し、実行権限を付与する。マウントポイントは /.home、マップファイルは amd.fstab である。

#!/bin/sh
#
# amd (am-utils) の起動・停止
#

killproc() {            # 指定したプロセスを終了する
        pid=`/usr/bin/ps -e |
             /usr/bin/grep $1 |
             /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
        [ "$pid" != "" ] && kill -INT $pid
}

case "$1" in

'start')
        if [ -x /usr/local/sbin/amd ]
        then
                /usr/local/sbin/amd -l /var/log/amd.log /.home amd.fstab > /dev/console 2>&1
        fi
        ;;

'stop')
        killproc amd                            # デーモンを終了する
        ;;
*)
        echo "Usage: /etc/rc2.d/S77amd { start | stop }"
        ;;
esac
chmod 755 /etc/rc2.d/S77amd

autofs を停止する

amd を使う場合、Solaris の autofs は停止する。