LoginSignup
18
20

More than 5 years have passed since last update.

nfsマウント

Last updated at Posted at 2013-08-24

ここが詳しい

nfsサーバー側

インストール
apt-get install nfs-kernel-server

nfs設定

公開設定
$ sudo vim /etc/exportfs
/home/htdocs/public/wikitten/library    192.168.11.0/24(all_squash,rw,sync,no_subtree_check)
  • all_squash ・・・ nobodyでアクセス
  • rw ・・・ 読み書き許可
  • sync ・・・ 変更内容をすぐにディスクに反映
  • no_subtree_check ・・・ パフォーマンス的に設定しておいたほうがいいらしい。
設定反映
$ sudo /etc/init.d/nfs-kernel-server restart
公開状況確認
$ sudo exportfs 
/home/htdocs/public/wikitten/library
        192.168.11.0/24

nfsクライアント側

インストール
$ sudo apt-get install nfs-common
$ sudo mount -t nfs 192.168.11.3:/home/htdocs/public/wikitten/library /mnt/ -o hard,intr
  • hard ・・・ サーバーが再起動した時などでもマウントを解除しない
  • intr ・・・ nfsのファイルへのkillを有効にする?hardオプションと一緒に使う。

fstab

192.168.11.3:/home/htdocs/public/wikitten/library  /home/user/wiki  nfs4 noauto,hard,intr  0 0

umountが失敗する場合

umount.nfs: 192.168.11.2:/var/log: not found / mounted or server not reachable

-fを使う
umount -f /mnt/nfs

ルーターのWAN側にNFSサーバがある場合

sudo mount 222.222.111.111:/mnt/share/ a

mount.nfs: access denied by server while mounting 222.222.111.111:/mnt/share/

  • insecureオプションをつける。(1024番ポートより上の通信を許可)
/etc/exports
- /mnt/share    222.222.111.110(rw,no_subtree_check,no_root_squash)
+ /mnt/share    222.222.111.110(rw,insecure,no_subtree_check,no_root_squash)
sudo exportfs -rav
ポート番号確認
/usr/sbin/rpcinfo -p

Macからマウント

sudo mkdir /Volumes/nfs/cdrom/
sudo mount_nfs -P 192.168.11.99:/mnt/cdrom /Volumes/nfs/cdrom/
18
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
20