Mounting NFS shares from your Z

From OESF

(Difference between revisions)
Jump to: navigation, search
m

Line 44:

Line 44:

Using automount/autofs is a way around that problem. I'll add instructions for that later.
Using automount/autofs is a way around that problem. I'll add instructions for that later.
 +
 +
[[Category:Network Applications]]

Revision as of 20:02, 21 April 2006

NFS, short for Network File System, is a common method for Unix servers to share filesystems on a network.

Contents

Server Setup

This document assumes that you will be using a Linux system as your NFS host. Other flavors of Unix will vary slightly.

In these examples, I will use a Linux host named bigbox, running Red Hat 9.

First, edit /etc/exports to define which mount points that you want shared. Use one line for each mountpoint:

/export *
/data/video *

Note that the asterisk means that anyone can connect to this share. It's highly recommended that you tighten security once you get it working. See the exports manpage for details.

Also I recommend ending the file with a newline. I've seen versions of NFS ignore the last entry if this is not the case.

Now restart your NFS server. (Red Hat puts these in /etc/init.d, other distros may use a different location.)

# /etc/init.d/nfs stop
# /etc/init.d/nfs start

And just to be safe, restart nfslock as well:

# /etc/init.d/nfslock stop
# /etc/init.d/nfslock start

Client Setup

There's no real pre-setup tasks that need to be done, just be sure that the Z is on the network and can ping the host. You also might want to put the hostname in /etc/hosts to make it easier.

Mounting the NFS filesystems on the Z

Create mountpoints if you don't already have them e.g.: mkdir /mnt/bigbox

Now you should be able to mount:
mount bigbox:/export /mnt/bigbox

If all goes well, there should be no error, and if you do ls /mnt/bigbox, you should see a list of the remote directory.

Automatically Mounting

You can define NFS shares to mount in /etc/fstab. I don't recommend setting them to automatically mount there (unless you use certain options that I can't remember). The reason for this is NFS clients often block if the NFS share they are trying to mount is not available. The client might not finish booting until the share is available.

Using automount/autofs is a way around that problem. I'll add instructions for that later.

Personal tools