これは日々の作業を通して学んだことや毎日の生活で気づいたことをを記録しておく備忘録である。
HTML ファイル生成日時: 2025/11/15 12:57:40.048 (台灣標準時)
rpcbind=YES mountd=YES nfs_server=YES lockd=YES statd=YES
# /etc/rc.d/rpcbind start Starting rpcbind.
/etc/exports というファイルがないので、 mountd が起動できなかった。シ ステムをインストールしたばかりの状態だと、このファイルは存在しない。新 たに作成する必要がある。 /etc/exports は以下のような内容とすればよい。# /etc/rc.d/mountd start /etc/rc.d/mountd: WARNING: /etc/exports is not readable.
/etc/exports ファイルを作成すれば、今度は mountd が起動する。/data0 -network 10.20.30.0 -mask 255.255.255.0 -maproot=root /data1 -network 10.20.30.0 -mask 255.255.255.0 -maproot=root
showmount コマンドを使って、 /etc/exports に書き込んだディレクトリが export されているかどうかを確認する。# /etc/rc.d/mountd start Starting mountd.
# showmount -e 10.20.30.1 Exports list on 10.20.30.1: /data0 10.20.30.0 /data1 10.20.30.0
# /etc/rc.d/nfsd start Starting nfsd.
rpcbind=YES nfs_client=YES lockd=YES statd=YES
# /etc/rc.d/rpcbind start Starting rpcbind.
NFS サーバのディレクトリをマウントしてみる。# showmount -e 10.20.30.1 Exports list on 10.20.30.1: /data0 10.20.30.0 /data1 10.20.30.0
期待通りにマウントすることができた。 以下のようにすれば、マウントを解除することができる。# df Filesystem 1K-blocks Used Avail %Cap Mounted on /dev/dk0 56928776 1632720 52449618 3% / tmpfs 1048444 70344 978100 6% /tmp kernfs 1 1 0 100% /kern ptyfs 1 1 0 100% /dev/pts procfs 4 4 0 100% /proc tmpfs 1048444 4 1048440 0% /var/shm # mount -t nfs 10.20.30.1:/data0 /mnt # # df Filesystem 1K-blocks Used Avail %Cap Mounted on /dev/dk0 56928776 1634656 52447682 3% / tmpfs 1048444 70896 977548 6% /tmp kernfs 1 1 0 100% /kern ptyfs 1 1 0 100% /dev/pts procfs 4 4 0 100% /proc tmpfs 1048444 4 1048440 0% /var/shm 10.20.30.1:/data0 492358832 69379396 398361496 14% /mnt
IP アドレスではなく、ホスト名を使ってマウントできる方が便利である。そ のためには、 /etc/hosts に記述を追加しておけばよい。例えば、以下のよう な記述を /etc/hosts に追加する。# umount /mnt
こうしておけば、以下のコマンドでマウントすることができるようになる。10.20.30.1 nb00
# mount -t nfs nb00:/data0 /mnt # df /mnt Filesystem 1K-blocks Used Avail %Cap Mounted on nb00:/data0 492358832 69499752 398241140 14% /mnt # umount /mnt
amd=YES
# mkdir /amd # mkdir /net # mkdir /etc/amd
/etc/amd.conf には、必要ではない記述も含まれているので、編集する。# cp -pi /usr/share/examples/amd/amd.conf /etc/ # chmod 644 /etc/amd.conf
# cd /etc # cp -pi amd.conf amd.conf.orig # ls -l amd.conf* -rw-r--r-- 1 root wheel 328 Jan 23 19:49 amd.conf -rw-r--r-- 1 root wheel 326 Jan 16 01:47 amd.conf.orig # vi amd.conf # diff -c amd.conf.orig amd.conf *** amd.conf.orig Sat Jan 16 01:47:48 2021 --- amd.conf Sat Jan 23 19:49:36 2021 *************** *** 8,15 **** dismount_interval = 900 map_type = file ! [ /cd ] ! map_name = /etc/amd/cd [ /net ] map_name = /etc/amd/net --- 8,15 ---- dismount_interval = 900 map_type = file ! #[ /cd ] ! #map_name = /etc/amd/cd [ /net ] map_name = /etc/amd/net
雛形のままだと、 read-only でのマウントしかできないので、 /etc/amd/net を編集する。# cp -pi /usr/share/examples/amd/net /etc/amd/ # chmod 644 /etc/amd/net
# cd /etc/amd
# ls -l
total 4
-rw-r--r-- 1 root wheel 338 Jan 23 19:50 net
-rw-r--r-- 1 root wheel 338 Jan 16 01:47 net.orig
# vi net
# diff -c net.orig net
*** net.orig Sat Jan 16 01:47:48 2021
--- net Sat Jan 23 19:50:16 2021
***************
*** 5,8 ****
#
/defaults type:=host;rhost:=${key};fs:=${autodir}/${rhost}/root
* host==${key};type:=link;fs:=/ \
! host!=${key};opts:=ro,soft,intr,nodev,nosuid,noconn
--- 5,8 ----
#
/defaults type:=host;rhost:=${key};fs:=${autodir}/${rhost}/root
* host==${key};type:=link;fs:=/ \
! host!=${key};opts:=rw,soft,intr,nodev,nosuid,noconn
# /etc/rc.d/amd start Starting amd.
# ls -l /net/nb00/data0 total 4 drwxr-xr-x 4 root wheel 512 Oct 11 20:40 netbsd # df nb00:/data0 Filesystem 1K-blocks Used Avail %Cap Mounted on nb00:/data0 492358832 69499752 398241140 14% /amd/nb00/root/data0