NFS Tips

Donnie Barnes, djb@redhat.com V1.1, February 26, 1996

1 Preface

“Red Hat Tips” are documentation meant to help Red Hat users with specific tasks. Some of these documents are for new users, some are for advanced users. Hopefully each document will also be of help for both new and advanced users. If you have contributions to make, please send them to tech-sup@redhat.com. If you have changes that need to be made to individual Tips, send them to the author of that document.

2 Introduction

NFS stands for Network FileSystem, and is a way to share files between machines as if they were on your local hard drive. Linux can be both an NFS server and an NFS client, which means that it can “export” filesystems to other systems, and “mount” filesystems exported from other machines.

3 Mounting NFS Filesystems

Use the mount command to mount a NFS filesystem from another machine:

     mount porky:/mnt/export /mnt/local

In the above command, “porky” is the hostname of the NFS fileserver, “/mnt/export” is the filesystem that porky is exporting, and “/mnt/local” is a directory on my local machine where I want to mount the filesystem. After the mount command runs (and if I had the proper permissions from porky) - voila! - I can ‘ls /mnt/local’ and get a listing of the files in /mnt/export on porky.

4 Exporting NFS Filesystems

The file that controls what filesystems you wish to export is “/etc/exports”. Its format is:

     directory       hostname(options)

the “(options)” are optional. For example:

     /mnt/export     speedy.redhat.com

would allow speedy.redhat.com to mount /mnt/export, but:

     /mnt/export     speedy.redhat.com(ro)

would only allow speedy to mount /mnt/export read-only.

Each time you change /etc/exports, you need to tell the NFS daemons to examine it for new information. One simple way to accomplish this is to just stop and start the daemons:

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

The following will also work:

     killall -HUP rpc.nfsd rpc.mountd

The best way to see what is actually exported, is the showmount command (showmount(8)). To see what filesystems are currently exported on your current machine, you would type showmount -e. To see what filesystems are exported on a remote machine (like fred.foo.com), you would do showmount -e

fred.foo.com.

5 Further Reading

See the following man pages for more details: nfsd(8), mountd(8), and exports(5). Another good reference is “Managing NFS and NIS Services” published by O’Reilly and Associates.

6 Copyright Notice

This document is Copyright (C) 1996 by Red Hat Software. Redistribution of this document is permitted as long as the content remains completely intact and unchanged. In other words, you may reformat and reprint or redistribute only.