Logicalwebhost Cheatsheet

Linux & Open Source Cheatsheets & Howto's

Skip to: Content | Sidebar | Footer

nfs howto

Nfs allows you to remotely mount a directory so it acts like it’s local, and also make it mount the same place every time you boot up. It’s really handy, pretty simple and quite proven in the field.

nfs howto

first set up the server

apt-get install nfs-kernel-server
vi /etc/exports
  /folder/you/want/your/remote/box/to/see 192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async)
exportfs -a
exportfs

if everything worked, you should see an entry like

/folder/you/want/your/remote/box/to/see    192.168.1.0/24

now mount the folder on your client like:

su
apt-get install nfs-common 
mount -t nfs 192.168.1.5:/folder/you/want/your/remote/box/to/see /place/where/you/want/it/mounted/locally
mount

if things went well, you should see an entry like:

192.168.1.5:/ on /place/where/you/mounted/it/locally type nfs (rw,addr=192.168.1.5)

if you want to make it mount automatically every time you boot the client, add a line to /etc/fstab like:

vi /etc/fstab
  192.168.5.115:/folder/you/mounted/on/the/server /place/where/you/want/it/locally   nfs     _netdev,auto  0  0

the _netdev waits until your network comes up before mounting it, the “auto” waits until your system boots up before mounting.

Write a comment

You need to login to post comments!