Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old September 3rd, 2006   #1
malco2001
First Cup of Ubuntu
 
Join Date: Apr 2006
Beans: 4
HOWTO: NFS Server/Client

Why NFS?

I simply wanted to experiment with NFS, and couldn't seem to find the documentation here on the forums. I found using NFS just as easy if not easier than using Samba for sharing between a few of my Unix based systems. In order to share a folder it only required a single line in a configuration file under /etc/exports, and a single line under /etc/fstab on the client to mount the share on each client at boot.

I mostly edited and moved things around from these guides to make a more complete single guide to getting this working using Ubuntu.

http://www.cyberciti.biz/tips/ubuntu...nfs-share.html (for client configuration)
http://www.redhat.com/docs/manuals/l...nfs-mount.html (for mounting using fstab)
<removed dead link>
http://www.freebsd.org/doc/en_US.ISO...twork-nfs.html (contains more info about NFS)

Install NFS Server Support
at the terminal type
sudo apt-get install nfs-kernel-server nfs-common portmap
When configuring portmap do =not= bind loopback. If you do you can either edit /etc/default/portmap by hand or run:
sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart


Editing /etc/exports
the /etc/exports file is used for creating a share on the NFS server

invoke your favorite text editor or
sudo vi /etc/exports

Here are some quick examples of what you could add to your /etc/exports

For Full Read Write Permissions allowing any computer from 192.168.1.1 through 192.168.1.255
  • /files 192.168.1.0/24(rw,no_root_squash,async)

Or for Read Only from a single machine
  • /files 192.168.1.2 (ro,async)
save this file and then in a terminal type
sudo /etc/init.d/nfs-kernel-server restart

Also aftter making changes to /etc/exports in a terminal you must type
sudo exportfs -a

Install NFS client support
sudo apt-get install portmap nfs-common

Mounting manually
Example to mount server.mydomain.com:/files to /files. In this example server.mydomain.com is the name of the server containing the nfs share, and files is the name of the share on the nfs server

The mount point /files must first exist on the client machine.
cd /
sudo mkdir files


to mount the share from a terminal type

sudo mount server.mydomain.com:/files /files

Note you may need to restart above services:
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart


Mounting at boot using /etc/fstab
Invoke the text editor using your favorite editor, or
gksudo gedit /etc/fstab

In this example my /etc/fstab was like this:
  • server.mydomain.com:/files /files nfs rsize=8192,wsize=8192,timeo=14,intr
You could copy and paste my line, and change “servername.mydomain.com:/files”, and “/files” to match your server name:share name, and the name of the mount point you created.
It is a good idea to test this before a reboot in case a mistake was made.
type
mount /files
in a terminal, and the mount point /files will be mounted from the server.

Last edited by dmizer; August 5th, 2009 at 07:10 PM.. Reason: removed dead link
malco2001 is offline   Reply With Quote
Old September 7th, 2006   #2
Jose Catre-Vandis
May the Ubuntu Be With You!
 
Jose Catre-Vandis's Avatar
 
Join Date: Mar 2006
Location: Hampshire,UK
Beans: 1,640
Xubuntu 9.04 Jaunty Jackalope
Re: HOWTO: NFS Server/Client

Thanks, this howto made simple what the wiki howto makes look difficult. I can now dispense with the vagaries of samba
__________________
Experience is the only genuine knowledge
Still stuck on Jaunty until they fix the Karmic kernel for my dvb card (Asustek Dual P7131) Upgrade scmupgrade
Bimmablog
Jose Catre-Vandis is online now   Reply With Quote
Old September 7th, 2006   #3
InspirationDate
5 Cups of Ubuntu
 
Join Date: Apr 2006
Location: Toronto
Beans: 19
Ubuntu 9.04 Jaunty Jackalope
Re: HOWTO: NFS Server/Client

Thanks for the howto. The only problem I ran into was with this line:

Quote:
Originally Posted by malco2001 View Post
save this file and then in a terminal type
/etc/init.d/nfs-kernel-server restart
it gave me a bunch of errors until I sudo'd it.

sudo /etc/init.d/nfs-kernel-server restart
InspirationDate is offline   Reply With Quote
Old September 8th, 2006   #4
cgreulich
First Cup of Ubuntu
 
Join Date: Aug 2006
Beans: 7
Re: HOWTO: NFS Server/Client

Thank you for writing this!!! I have been sifting through posts for two days trying to figure out how to share files between my two ubuntu(dapper) pc's. Your instructions worked the first time I tried them.
cgreulich is offline   Reply With Quote
Old September 11th, 2006   #5
malco2001
First Cup of Ubuntu
 
Join Date: Apr 2006
Beans: 4
Re: HOWTO: NFS Server/Client

Quote:
Originally Posted by malco2001
save this file and then in a terminal type
/etc/init.d/nfs-kernel-server restart
Quote:
Posted by InspirationDate
it gave me a bunch of errors until I sudo'd it.
i edited my post to fix that. i'm glad it worked so well for all of you.

Last edited by malco2001; September 11th, 2006 at 12:28 AM..
malco2001 is offline   Reply With Quote
Old September 12th, 2006   #6
quad3d@work
Just Give Me the Beans!
 
Join Date: Jun 2006
Location: Austin, TX
Beans: 50
Ubuntu 8.04 Hardy Heron
Re: HOWTO: NFS Server/Client

Had some serious speed problem with Samba. Setting up NFS from your guide works well! Now I'm doing 30-40Mb (gigabit network) per sec instead of 1-3Mb with Samba. Thanks!
__________________
Vista on home desktop.
Arch on laptop and workstation.
Arch, Solaris, Debian, Ubuntu, CentOS/RHEL servers.
quad3d@work is offline   Reply With Quote
Old September 14th, 2006   #7
jabb
First Cup of Ubuntu
 
Join Date: Sep 2006
Beans: 2
Re: HOWTO: NFS Server/Client

thanks for this guide really cool

however I have a bunch of Disks mountet on the server i home dir
and I wanted to just mount the home dir in the client.
I did'nt work. I could not see the subdirs for some reason.

thoug if in export I make explicit what dirs to export where the dirs are disks, then it worked fine after restarting the service and making new mount points of course.

though if someone can explain how to just mount the home of the server that would be great. I did everything as the guide instructed.
jabb is offline   Reply With Quote
Old September 14th, 2006   #8
mike3k
Just Give Me the Beans!
 
mike3k's Avatar
 
Join Date: Sep 2006
Location: Fort Lauderdale, FL
Beans: 47
Ubuntu 6.10 Edgy
Send a message via AIM to mike3k Send a message via Skype™ to mike3k
Re: HOWTO: NFS Server/Client

If you're connection to a Linux NFS server from Mac OS X, you need to specify 'insecure' in your exports and map the user IDs since Macs use uid 501 for the first regular user. For my /etc/exports I use:

/home 192.168.0.0/255.255.255.0(rw,async,insecure,all_squash,anonuid =1000,anongid=1000)
mike3k is offline   Reply With Quote
Old September 15th, 2006   #9
p388l3s
5 Cups of Ubuntu
 
Join Date: Aug 2006
Beans: 27
Smile Re: HOWTO: NFS Server/Client

Thankyou malco2001,

Very precise and to the point, gained access to my freenas box in mere moments once i read this post, now to make sunbird share it's calendar file for both my ubuntu and windows boxes.

Many thanks

Pebbles
p388l3s is offline   Reply With Quote
Old September 15th, 2006   #10
probablydrew
First Cup of Ubuntu
 
Join Date: Mar 2006
Location: Tucson, AZ, USA
Beans: 5
Dapper Drake Testing/
Send a message via AIM to probablydrew Send a message via Yahoo to probablydrew
Re: HOWTO: NFS Server/Client

thanks, I found this helpful, and quite easy to config with the built in nfs module in webmin. I also experienced a speed increase of about double over samba.
probablydrew is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:27 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry