Enter your email address:

Delivered by FeedBurner

NFS - Creating a Network drive Quick NFS how-to


StumbleUpon Toolbar

NFS or Network File System is a great way to share documents, or expand your disk space, using the disk on another server, I am using it to share documents between my office and home, I have my office disk mounted in my home's PC using NFS.

Well the PC at my office has CentOS, so the first thing I need is to install the necessary software.

yum install nfs-utils portmap

If you are using Debian write:

sudo aptitude install nfs-user-server pormap

Ok, now we need to configure it, there are basically two configuration files one in the server side, and one the client side.

At the server

We need to edit /etc/exports file and add something like this:

/home/user/       192.168.1.0/255.255.255.0(rw,sync)

That line tells the server that the directory /home/user is allowed to be exported to all the class C 192.168.1.0 PCs, and they will have read and write access, and sync makes the server to be sure that files are written to stable storage, and with async the server tells the client it has written while it actually has not, so it improves performance but can corrupt data.

Now we need to start the daemons.

/etc/init.d/portmap start

/etc/inid.d/nfs start

At the client side

Now at the client site, we need to mount the partition, we have two options:

Manually

mkdir /media/nfs

That line is only needed once, and it is to have a mount point.

mount 192.168.1.1:/home/user /media/nfs

Automatically

Edit the /etc/fstab and add the following line:

10.1.1.1:/home/nfs /media nfs rw,hard,intr 0 0

Now it is mounted, the permissions will be the same than in the server side, in my case because I was using CentOS on the server and Debian on the client, I had the problem that all files belonged to user 500 and group 500 (first user in CentOS) but in Debian it is usually 1000, so I had to create another user in the server side:

useradd nfs -u 1000

And then I copied all my needed files on the /home/nfs directory.

Trouble shouting

If you have any trouble use this command to see if everything is ok.

rpcinfo -p

The output should be something like this:

   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100011    1   udp    972  rquotad
    100011    2   udp    972  rquotad
    100011    1   tcp    975  rquotad
    100011    2   tcp    975  rquotad
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100021    1   udp  32773  nlockmgr
    100021    3   udp  32773  nlockmgr
    100021    4   udp  32773  nlockmgr
    100021    1   tcp  32774  nlockmgr
    100021    3   tcp  32774  nlockmgr
    100021    4   tcp  32774  nlockmgr
    100005    1   udp    988  mountd
    100005    1   tcp    991  mountd
    100005    2   udp    988  mountd
    100005    2   tcp    991  mountd
    100005    3   udp    988  mountd
    100005    3   tcp    991  mountd

Finally I really recommend you to read this documents.

CentOS NFS
NFS Howto

Trackback URL for this post:

http://www.go2linux.org/trackback/465
StumbleUpon Toolbar

 If you like this article, subscribe to our full rss

If this article was somehow useful for you, you can leave something in the tip's jar

Please post your question in our forum and use comments only to leave your comments about the article, thanks.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Captcha
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

This site is proudly hosted at Bluefur Hosting