How to setup NFS

Posted by peter on October 25, 2011

Make sure the “nfsserver” and “portmap” services have started. You can set them to start at bootup by typing the following:

chkconfig nfsserver on
chkconfig portmap on

Now “vi” the /etc/exports file to define which folders need to be exported, the syntax is as follows:

Directory Host(options1,option2,option3)

Note that “host” can be a computer name or an IP address. It can also be a network name (use a * before your domain name, eg *.yourdomain.co.za) or a network IP range. You can also use a * to indicate everyone. Here is an example of a computer name

/data/ peterhpc(rw) fredblog(rw)

You can share a folder temporarily by using the “exportfs” command as follows:

exportfs -o ro,root_squash,sync 192.168.0.0/24:/data

Client

You can use the command “showmount -e (or-a) computername” to show which folders are the export directories on a computer. If you leave off the “computername” it will default to the computer you are accessing

You can mount a remote “share” if you type the following at the command prompt:

mount -t smbfs -o (options) (devise directory)

For this to work, you need to have had started the “portmap” service by typing in the following at the command prompt:

rcportmap start


If you don’t want to mount this directory permanently (ie mount on boot up) type the following:

mount -o soft computername:/data /data2/temp/

You can edit the /etc/fstab file and put in a line similar to the following:

peterh@yourdomain.co.za:/data /datalocal nfs default 0 0

Comments:

Leave a Reply



(Your email will not be publicly displayed.)

Please type the letters and numbers shown in the image.Captcha CodeClick the image to see another captcha.