Skip to content

NFS 是經由 LAN 或 WAN 存取遠端檔案。它的共用是基於 Server 和 Client 關係。因此設定 NFS 時需要有網路位置和共享路徑。

Env ​
  • 學校實驗室A系統
    • ubuntu 12.04
    • 公網
  • 學校實驗室B另一台主機
    • 公網

Server ​

Install ​

shell
sudo apt-get install nfs-kernel-server

share dir setting ​

shell
// 學校實驗A室備份都放置 /home1/....../backup/NFS
// share_dir client_ip(env setting)
$ sudo vi /etc/exports
share_dir 實驗室B_IP(rw,sync,no_root_squash,insecure,no_subtree_check)
$ sudo chown nobody:nogroup share_dir
$ sudo service nfs-kernel-server restart

client_ip 就是實驗室B_IP,因為只限制該B實驗室存取,如果使用 * 則表示所有都可存取。

Option ​
  • rw
    • read and write operations
  • sync
    • write any change to the disc before applying it
  • no_subtree_check: prevent subtree checking
  • no_root_squash
  • insecure

Client ​

Install ​

shell
sudo apt-get install nfs-common

Mount directory of NFS ​

shell
$ sudo mount [nfs_server_ip]:[server_share_dir] [client_dir]

參考資料 ​

Built with VitePress