Thursday, April 22, 2010

NFS Media Center Sharing

By: Jason Bird

Before we begin:

I am assuming a few things about your system/network in this how-to that I personal feel offers a cleaner more stable network setup that will eliminate possible performance and connectivity issues down the road.

  1. This guide is write for a Ubuntu server/desktop setup. The same concepts apply to other distributions but your package manager may be different.

  2. I'm assuming your file server has a static IP address, since your file server is a server I find it best to remove a margin of error by always setting IP address for servers to static even in a home network.

  3. I'm assuming your Media Centers also have a static IP addresses, since I view Media Center in the same category as servers/ network appliances I feel it offers a more organized network by having them static. This way the Media Center always knows where the File Server is and the File Server always knows where the Media Center is coming from, Especial in a network that has multiple Media Centers.

  4. Since multiple Media Center are becoming more popular this How-To will setup the server to grant two Dedicated Media Centers access to it shares. If you have more just continue the network architecture to satisfy your needs.

  5. The File Server has a Folder in its root that houses the data. We will be using the root path /Media01

  6. We will setup the shares with full access to the following user for simplicity sake this will ensure read/write access from Media Center to File Server. The user in this How-To is mcuser

  7. My editor of choice in this How-To is pico since its simple to use and very light weight, however feel free to use any editor you like.

The Setup:

The table below lays out the systems we are using in this example, with their host name, a brief description and the static IP address being assigned to that machine.

Host Name


IP Address


File Server: This is going to serve files to the Media Centers


Media Center: This is the first Media Center in our setup. For all intensive purposes we can assume these have the same setup.


Media Center: This is the first Media Center in our setup. For all intensive purposes we can assume these have the same setup.

Create the File system architecture

The first thing we want to do is create the File Server's architecture. This is going to be the organizational back bone to our file server. All data files that are to be accessed from outside the server should be located here.

mkdir -p /Media01/home/public/

cd /Media01/home/public

mkdir video

mkdir mp3

mkdir pictures

NFS Server Setup

Install Needed Packages

Copy and past the command below to install the NFS file server

sudo apt-get install nfs-kernel-server

Exporting Shares:

On the file server you must export each directory or directories you want to share, and what hosts can access them. Use the following command to open the exports file for editing

sudo pico /etc/exports

Append this the following lines to /etc/exports:

#MC01 Shares




#MC02 Shares




Adding individual exports for one or two Media Centers works fine, but if you have more this can become cumbersome. To setup your exports file to allow an entire IP range you will use the following

#Global Media Center Share


What the above will do is grant all computers with the I doubt you will have 155 Media Centers running and if you did I doubt you will have need for this hot-to

Now run the following to ensure the exports have applied.

sudo exportfs -ra

This is about all it takes to setup a functional well organized back-end for your Media Center network now lets move on to the client side.

Client Setup

On both Media Centers install the base files needed to access the file server and mount the files shares exported in the previous section.

Run the following to install the nfs client packages

sudo apt-get install nfs-common

After the nfs-common package installs with all its dependencies it is time to setup the Media Centers architecture. Since the home directory of mcuser on both media center already have a Video, Pictures, and Music directories we will use those to mount the NFS shares.

Use the following to open your fstab file

sudo pico /etc/fstab

append the following to the bottom of your fstab file.

#NFS /home/mcuser/Videos nfs timeo=14,intr /home/mcuser/Music nfs timeo=14,intr /home/mcuser/Pictures nfs timeo=14,intr

Now that we setup the shares in fstab its time to see if we did everything right.

At the command prompt enter the following to reprocess the fstab file.

sudo mount -a

if all went well you should be dropped back into the command prompt and on the desktop of mcuser you should see the tree shares you created. The nice thing about this setup is, since we are using the same user that has read/write access to the system we wont have to worry about permissions and can treat the shares as local directories.

The next step is to repeat the client setup on every Media Center in your network. If you are using Moovida then it will automatically start scanning the Videos, Pictures, Music folders of mcuser once it is reloaded. If your using XBMC you will need to setup the shares manually.


  • Since this is a Media Center you should expect to be transferring significant amounts of data across the wire. I suggest having a 1 Gigabyte backbone to connect the two even better would be to round robin your file server preventing overloading a single nic but this is for another how-to and will not be covered here. Keep in mind though depending on your file server hardware your hard drives may not be able to access the data as fast as your network can send it. So try and get the fastest drives you can with in your budget.

Trouble Shooting tips:

  • If after running “sudo mount -a” you get a permission denied by server check the server log most times this happens is a error in the exports file or the client trying to access the server was set through dhcp.

No comments:

Post a Comment