Linux

Share Ubuntu folders with NFS

1 Mar/10

If you’ve ever tried to share folders on a Linux machine over a network, you’ve most likely attempted to get NFS working. And on many occasions you might have found yourself nearly pulling out your hair in frustration. Well, you’ll be glad to know that getting NFS working on modern Ubuntu systems is actually quite simple. You just have to have a couple of pieces installed and access to the /etc/exports file.

In this article I am going to demonstrate how simple it is to share a folder, using NFS, between a Ubuntu machine and a Debian machine. When all is said and done, you’ll be surprised at how simple it is.

What is NFS?

NFS stands for (take a guess…) Network File System. NFS is a protocol developed by Sun Microsystems in 1984 to allow computers to share files and folders over a network. NFS is an open standard, defined in RFCs, and allows any to implement the protocol.

Although many prefer to employ Samba for network folder sharing, NFS still has a lot of good uses and some even prefer it over the more flexible Samba.

Installation

Both client and server will need the package nfs-common. On the server machine you will need to install the package nfs-kernel-server. To install these packages follow these steps:

  1. Open up Synaptic (or your favorite Add/Remove Program utility).
  2. Search for “nfs” (no quotes).
  3. Mark nfs-common (for the client) and nsf-common and nfs-kernel-server (for the server).
  4. Click Apply to install.

That’s it. Now it’s time for a little configuration.

Configuration

For example’s sake, the two machines we are using are addressed as such:

Server: 192.168.1.100

Client: 192.168.1.10

On the client we will create a directory which the NFS server share will mounted to. We’ll create the folder ~/UBUNTU_NFS with the command mkdir ~/UBUNTU_NFS. Now let’s move over to the server.

The first thing to be done on the server machine is to create folder that will be shared out. Let’s call that folder ~/SHARE and we’ll create it with the command mkdir ~/SHARE.

Now we have to create an entry in the /etc/exports folder. This entry will tell NFS what to share and who to share with. The entry will look like:

/home/USERNAME/SHARE     192.168.1.10(rw)

Where USERNAME is the actual name of the user. NOTE: You could share a folder in /opt if you like.

Now nfs-kernel-server has to be restarted with the command:

/etc/init.d/nfs-kernel-server restart

Mounting

Hop back on to the client machine and issue the command:

sudo mount 192.168.1.100:/home/USER/SHARE /home/USER/UBUNTU_NFS

Where USER is the actual user name.

You should get no errors. Now let’s test this out. Hop on back to the server and create a file within ~/SHARE. After you create that file, check the ~/UBUNTU_NFS directory on the client to make sure the file shows up. Try to delete that file. Now create a file in the ~/UBUNTU_NFS directory on the client. You should have no problems creating a file.

Automounting

Say you want this share to always be mounted upon boot of the client machine. This, of course would require the server machine to be on. To do this add an entry on the client machine’s /etc/fstab that looks like:

192.168.1.100:/home/jlwallen/ELIVE  /home/jlwallen/UBUNTU  nfs rsize=1024,wsize=1024,noauto 0 0

NOTE: The above fstab entry is all one line.

Now that NFS share will mount even when the machine is rebooted.

Final thoughts

As you can see, NFS has become much easier than it was in the old days. Now, armed with NFS and Samba, you can be sharing files and folders with anyone and everyone.

Continua a leggere – Original Link: Share Ubuntu folders with NFS

Technorati Tags: , , , , ,

Realizzazione Sito Gestionale Immobiliare

Leggi Anche

Condividi
Condividi in DeliciousCondividi in DiggCondividi in RedditCondividi in StumbleCondividi in MixxCondividi in TecnoratiCondividi in Ok Notizie

Commenti

I commenti sono disabilitati per questo articolo.

I commenti sono chiusi.

Autore

    Spina Rosario
    Inserito da

Archivio

Iscrizione Newsletter

    Tieniti informato con tutte le novità del mondo informatico con la nostra newsletter
    Email:

    Nome:

    Auto Shop Italia
    Web Burning Blog
    Info Privacy

Meta