Notebook
これは日々の作業を通して学んだことや毎日の生活で気づいたことをを記録しておく備忘録である。
HTML ファイル生成日時: 2025/07/30 08:17:51.269 (台灣標準時)
NetBSD での NFS と amd の設定
NetBSD での、 NFS 及び amd の設定の仕方は以下の通り。
NFS サーバでの作業
まず、 NFS サーバとなる計算機での設定について整理する。
/etc/rc.conf
/etc/rc.conf に以下の記述を追加する。ここでは、 10.20.30.1 が NFS サー
バであると仮定する。
rpcbind=YES
mountd=YES
nfs_server=YES
lockd=YES
statd=YES
デーモンの起動
必要なデーモンを起動する。
rpcbind
最初に、 rpcbind を起動する。
# /etc/rc.d/rpcbind start
Starting rpcbind.
mountd
次に、 mountd を起動する。
# /etc/rc.d/mountd start
/etc/rc.d/mountd: WARNING: /etc/exports is not readable.
/etc/exports というファイルがないので、 mountd が起動できなかった。シ
ステムをインストールしたばかりの状態だと、このファイルは存在しない。新
たに作成する必要がある。 /etc/exports は以下のような内容とすればよい。
/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
/etc/exports ファイルを作成すれば、今度は mountd が起動する。
# /etc/rc.d/mountd start
Starting mountd.
showmount コマンドを使って、 /etc/exports に書き込んだディレクトリが
export されているかどうかを確認する。
# showmount -e 10.20.30.1
Exports list on 10.20.30.1:
/data0 10.20.30.0
/data1 10.20.30.0
nfsd
更に、 nfsd を起動する。
# /etc/rc.d/nfsd start
Starting nfsd.
NFS クライアントでの作業
NFS サーバでの設定が終わったら、今度は NFS クライアントで設定を行う。
NFS クライアントは 10.20.30.100 であると仮定する。
/etc/rc.conf
まず、 /etc/rc.conf に以下の記述を追加する。
rpcbind=YES
nfs_client=YES
lockd=YES
statd=YES
デーモンの起動
必要なデーモンを起動する。
rpcbind
rpcbind を起動する。
# /etc/rc.d/rpcbind start
Starting rpcbind.
NFS マウント
showmount コマンドを使って、 NFS マウントしたいディレクトリが見えるか
どうか確認する。
# showmount -e 10.20.30.1
Exports list on 10.20.30.1:
/data0 10.20.30.0
/data1 10.20.30.0
NFS サーバのディレクトリをマウントしてみる。
# 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
期待通りにマウントすることができた。
以下のようにすれば、マウントを解除することができる。
# umount /mnt
IP アドレスではなく、ホスト名を使ってマウントできる方が便利である。そ
のためには、 /etc/hosts に記述を追加しておけばよい。例えば、以下のよう
な記述を /etc/hosts に追加する。
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 の設定
必要になったときにいちいち root になって mount コマンドを実行して NFS
マウントし、必要なくなったらまた root になって umount するというのは面
倒である。 amd を使うと、必要になったときに自動で mount してくれるよう
にすることができる。
/etc/rc.conf
/etc/rc.conf に以下の記述を追加する。
amd=YES
ディレクトリの作成
必要なディレクトリを作成する。
# mkdir /amd
# mkdir /net
# mkdir /etc/amd
/etc/amd.conf
/etc/amd.conf というファイルを準備する。雛形をコピーする。
# cp -pi /usr/share/examples/amd/amd.conf /etc/
# chmod 644 /etc/amd.conf
/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
/etc/amd/net
/etc/amd/net を準備する。雛形をコピーする。
# cp -pi /usr/share/examples/amd/net /etc/amd/
# chmod 644 /etc/amd/net
雛形のままだと、 read-only でのマウントしかできないので、 /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
デーモンの起動
amd デーモンを起動する。
# /etc/rc.d/amd start
Starting amd.
amd による自動マウントの確認
/net/nb00/data0 にアクセスすれば、 amd により自動的に NFS マウントが行
われる。
# 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
- About this article:
- author: daisuke
- file: 20210124_1.html
- category: Computer___NetBSD
- title: NetBSD での NFS と amd の設定
- mode: public
- last modified: 2021/01/24 19:42:32 (Taiwan Standard Time)
- html generated: 2025/07/30 08:17:51.269 (Taiwan Standard Time)
Frequently accessed files
- Misc___Taiwan/20240819_00.html
- 24 page views
- title: 住所から台灣の郵便番号を調べる方法
- Computer___TeX/20231107_00.html
- 23 page views
- title: LaTeX での counter の利用方法について
- Computer___NetBSD/20240805_03.html
- 19 page views
- title: NetBSD 10 のインストール
- Computer___NetBSD/20250728_00.html
- 18 page views
- title: pkgsrc の geography/gdal-lib について
- Computer___TeX/20240410_00.html
- 16 page views
- title: pdfTeX を使って PDF ファイルを作る方法
- Misc___Taiwan/20250728_01.html
- 15 page views
- title: 「我那小小多山的國家」という言葉が流行っている
- Computer___Network/20230516_00.html
- 14 page views
- title: OpenVPN 2.6 を使い VPN Gate に接続するときの注意点
- Misc___Taiwan/20240207_00.html
- 14 page views
- title: 台灣から台灣の外に EMS で荷物を発送する方法
- Misc___Taiwan/20240903_01.html
- 14 page views
- title: 台湾の郵便局で EMS を利用して荷物を海外に送る方法
- Computer___NetBSD/20250409_00.html
- 14 page views
- title: Raspberry Pi 5 に NetBSD-10.1 をインストールする手順
- Computer___NetBSD/20241102_00.html
- 13 page views
- title: ImageMagick の convert コマンドについて
- Computer___Network/20230726_00.html
- 12 page views
- title: git の SSL certificate problem の解決方法
- Computer___NetBSD/20230119_00.html
- 12 page views
- title: NetBSD でバイナリーパッケージを利用する方法
- Computer___NetBSD/20250301_01.html
- 12 page views
- title: yt-dlp で YouTube の動画をダウンロードするときのこと
- Computer___TeX/20240414_01.html
- 11 page views
- title: LuaTeX を使って日本語と中国語の漢字が混在した PDF ファイルを作成する方法
- Computer___Python/20231008_00.html
- 11 page views
- title: NumPy と SciPy による標準偏差の計算について
- Food___Taiwan/20230609_12.html
- 11 page views
- title: 「25 食堂」の塔香雞腿炒麵
- Computer___Hardware/20240820_00.html
- 10 page views
- title: Raspberry Pi 5 の演算性能
- Computer___Python/20250330_00.html
- 10 page views
- title: Jupyter Notebook で Matplotlib を使うときのこと
- Computer___NetBSD/20240719_00.html
- 10 page views
- title: Raspberry Pi 4 に NetBSD-10 をインストールする手順
- Misc___Japan/20240610_00.html
- 9 page views
- title: NHK ラジオの「聞き逃し」の変更点 (2024 年 06 月)
- Computer___Network/20220817_6.html
- 9 page views
- title: okular に markdown 文書を表示させる
- Computer___NetBSD/20250113_00.html
- 8 page views
- title: TigerVNC での X server の解像度の指定について
- Computer___Network/20241214_00.html
- 8 page views
- title: Google Colab で Python 3.12 を使う方法
- Food___Taiwan/20220812_5.html
- 8 page views
- title: 「鶯歌冰鎮」のかき氷
- Computer___TeX/20241108_00.html
- 8 page views
- title: Beamer で columns 環境を使って二段組を実現する際に注意すること
- Misc___Taiwan/20250125_00.html
- 7 page views
- title: 店頭展示品の値段について
- Computer___Network/20210205_0.html
- 7 page views
- title: Apache のログファイルの設定
- Computer___Network/20240130_00.html
- 7 page views
- title: Google Colaboratory で Python 3.12 を使う方法
- Computer___TeX/20240411_00.html
- 7 page views
- title: LuaTeX を使って PDF ファイルを作成する方法
HTML file generated by Kinoshita Daisuke.