とらりもんHOME  Index  Search  Changes  Login

NFS

NFS (network file system) on Ubuntu 16.04

2020/03/26 Kenlo Nasahara

  • Suppose xxx.xxx.xxx.xxx is the IP address of the NFS server.
  • Suppose yyy.yyy.yyy.yyy is the IP address of the NFS client.
  • Suppose you want to mount /work on the server to /work on the client.
  • Note: In some cases, SSH-FS may be more useful and suitable than NFS. Especially if you are not admin of the server, and the admin does not help you, NFS is a bad choice.

install requirements

(server)
$ sudo apt-get install -y nfs-kernel-server
(client)
$ sudo apt-get install -y nfs-common

setting

(server)
sudo vi /etc/exports
/work  yyy.yyy.yyy.yyy(rw,sync,no_subtree_check)
sudo exportfs -ra
sudo vi /etc/
(no need to take care of /etc/hosts.allow)
sudo rpcdebug -m nfsd all   # this is for log output to /var/log/syslog
(client)
sudo mkdir /work

mount test

(client)
$ sudo mount -t nfs xxx.xxx.xxx.xxx:/work /work

automount on the client

(client)
$ sudo vi /etc/fstab
xxx.xxx.xxx.xxx:/work    /work   nfs    defaults 0 0

NFSごしに, クライアントのデータをサーバーにsudoでバックアップするとき

クライアントのsudoにサーバー上でのパーミッションを変える力を与える必要がある。それが"no_root_squash"というオプション(危ないから注意な)。 https://www.microfocus.co.jp/manuals/ED21/html/GUID-D936AA34-FCA5-474B-BB3B-3F6747E0E655.html

$ sudo vi /etc/exports
/home/nasahara 192.168.0.1(rw,no_root_squash)

みたいにする。

サーバー上のシンボリックリンク

サーバーでシンボリックリンクされたディレクトリは, NFSでは見失うらしい。シンボリックリンクされたディレクトリをNFSでマウントするのも無理っぽい。
Last modified:2021/10/27 09:43:19
Keyword(s):
References: