Skip to content

Instantly share code, notes, and snippets.

@Remiii
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save Remiii/571ea5ea8a0e88c2e3d6 to your computer and use it in GitHub Desktop.

Select an option

Save Remiii/571ea5ea8a0e88c2e3d6 to your computer and use it in GitHub Desktop.
Mount NFS (server/client config)

Mount NFS

This file describe a basic config for NFS mount on a server/client.

Server (store datas) - server.myserver.com

Share a datas folder : /home/ubuntu/documents/datas

$ sudo apt-get update
$ sudo apt-get install language-pack-fr
$ sudo apt-get install nfs-kernel-server
$ sudo service nfs-kernel-server start
$ vim /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#		to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#

/home/ubuntu/documents/datas client.myserver.com(rw,sync,subtree_check)
$ sudo service nfs-kernel-server reload
$ sudo exportfs -av

Client (consume datas) - client.myserver.com

$ sudo apt-get update
$ sudo apt-get install language-pack-ft
$ sudo apt-get install nfs-common

Manual mount

$ mkdir /home/ubuntu/mount1
$ sudo mount server.myserver.com:/home/ubuntu/documents/datas/ /home/ubuntu/mount1

If you need to unmount

$ sudo umount mount1

Auto mount (AutoFS)

This conf doesn’t works!

$ sudo apt-get install autofs
$ vim /etc/auto.master
$ vim /etc/auto.nfs
$ sudo service autofs restart

Check the result

$ df -h

Sources

Authors

Rémi Barbe (aka Remiii)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment