Personal tools

NFS Server and Client Configuration

From Rivendell Wiki

Jump to: navigation, search

FIXME: Clean up combined pages.

These instructions copied from and adapted to suit the Rivendell environment... http://www.ubuntugeek.com/nfs-server-and-client-configuration-in-ubuntu.html

Install NFS Server in Ubuntu

 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 using the following

 sudo vi /etc/default/portmap

or use the following command

 sudo dpkg-reconfigure portmap

Restart Portmap using the following command

 sudo /etc/init.d/portmap restart

NFS Server Configuration

NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.

You need to edit the exports file using the following command

 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

 /var/snd 192.168.1.1/24(rw,no_root_squash,async)

Or for Read Only from a single machine (Read only not recommended for Rivendell)

 /var/snd 192.168.1.2(ro,async)

save this file and exit

A client can be specified either by name or IP address. Wildcards (*) are allowed in names, as are netmasks (e.g. /24) following IP addresses, but should usually be avoided for security reasons.

A client specification may be followed by a set of options, in parenthesis. It is important not to leave any space between the last client specification character and the opening parenthesis, since spaces are intrepreted as client seperators.

Now you need to restart NFS server using the following command

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

If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command

 sudo exportfs -a

Install NFS client support in Ubuntu

 sudo apt-get install portmap nfs-common

This will install all the required packages for nfs client

Mounting manually

Example to mount server.mydomain.com:/var/snd to /var/snd. 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 /var/snd must first exist on the client machine.

Create files directory using the following command

 sudo mkdir /var/snd

You need to mount the share using the following command

 sudo mount server.mydomain.com:/var/snd /var/snd

Now you may need to restart services using the following command

sudo /etc/init.d/portmap restart

 sudo /etc/init.d/nfs-common restart

Mounting at boot using /etc/fstab

If you want to mount using fstab file

 sudo vi /etc/fstab

In this example my /etc/fstab was like this

server.mydomain.com:/var/snd /var/snd nfs rsize=8192,wsize=8192,timeo=14,intr

Change “servername.mydomain.com:/var/snd”, and “/var/snd” to match your server name,share name, and the name of the mount point you created.

Issuing the command

 sudo mount -a

will mount all the drives as described in the /etc/fstab file. If there are no mistakes you won't get any error messages.

Firewall Ports for NFS

If you have a firewall you need to make sure ports 32771, 111 and 2049 are open Testing Your Configuration

Use the following command in terminal to test

 mount /var/snd

the mount point /var/snd will be mounted from the server.

It still does not play out audio! Now What? - Need same UIDs and GIDs

Q: I have recently done a fresh installation of our 5 studio system and they all connect to a central SQL and Audio server. However we test the machines separately and they playout fine when we set them up to point at the server it gets the music library but wont play the audio. E.G. we put something on the cartwall and click, the time goes down but the meters don't display anything and no audio comes from the machine!! This has happened on every machine! I'm wondering if i have missed anything from the setup procedure. P.s we used RRABuntu (the latest Edition) to install the system and the server is a debian lenny OS

A1: You need to have the same linux user and group on all machines as is listed in /etc/rd.conf.

This all changes with the 2.0 versions that are in beta now and not for production.

If you are using ntfs in linux to share then you should be ok but I think I read somewhere that the uid for the same users on the different machines must be the same on all machines. In other words if on studio one linux user rduser has a uid of 1000 and on superserver linux user rduser has a uid of 1001 things will not work properly. From what I know uids are assigned in Ubuntu starting at 1000 and going upward for each user created.

A2: You can also force UID and GID for the clients. Here is my /etc/exports (on the NFS server)

/var/snd 192.168.80.0/21(rw,sync,all_squash,no_subtree_check,anonuid=1001,anongid=111) 

on the server rduser has the UID 1001, 111 is the GROUP number for rivendell


Just out of curiosity...

Why are you wanting to use a Windows file server as opposed to setting up a Linux file server?

It has always been the general consensus among the system admins that I've worked with that the SMB protocol is inferior to NFS. I'm not a network file system guru by any stretch and, as such, am not equipped to argue for or against SMB. Though I recall something about SMB being particularly problematic with how it handles file locks.

If you already have a built to the hilt Windows file server not being utilized to it's full potential, I suppose I can see your motive. But, barring that, it is my very humble opinion that you'd be better served with a file server running the same OS as your Rivendell machines.

As an added bonus, it doesn't get much simpler in terms of configuration. After installing the necessary packages, add one line to one file each of the file server and client machine(s) and you're in business.

What I am attempting to convey is that setting up an NFS file share in an all *NIX environment is as simple as adding a line to /etc/exports on the file server and adding a line to /etc/fstab on the client machine(s).

For example, on my dev/test setup...

This line in /etc/exports shares the /var/snd directory via NFS:
/var/snd    192.168.0.0/24(rw,root_squash,sync) 

A common mistake is to put a space before the open paren. Doing so causes options to be ignored. One nasty side effect of this is that the share will mount up read-only by default.

This line in /etc/fstab on the client machine(s) mounts up the share:
192.168.0.10:/var/snd /var/snd nfs rsize=8192,wsize=8192,timeo=14,intr,noauto 

I have "noauto" set because this is a test setup and I would prefer to manually mount the share as needed. In a production config, you would want the share to auto mount. Also, this rsize and wsize values have not been tuned for peak performance.

If you're going for simplicity, this beats fooling around with trying to get Samba to play nice with a Windows file server.