NFS

From OLPC
Revision as of 04:35, 22 December 2010 by Dds (talk | contribs) (Undo revision 244145 by 83.145.241.84 (Talk))
Jump to: navigation, search

The Network File System lets you use files on another machine as if they were actually on your XO-1 laptop.

Installation

Installation consists of two steps:

  • adding a package to your XO-1 laptop, and
  • adding an authorization line to the NFS server

For the sake of being specific, the procedures below assume

  • your XO-1 laptop's IP Address is 192.168.1.250;
  • the IP Address of the NFS server is 192.168.1.2;
  • you want /home/johndoe on the NFS server to be visible as /mnt on your XO-1 laptop.

To find your XO-1's actual IP Address, do this in Terminal ActivityActivity-terminal.svg:

su -
ifconfig
exit

Look at the lines that start with inet addr:. One will show 127.0.0.1; ignore this one. Likely ignore the one for the mesh network, named msh0. The one that's left will be the one you want to use.

Installing NFS capability on your XO-1

On your XO-1 laptop, in Terminal ActivityActivity-terminal.svg, install the nfs-utils package:

su -
yum install nfs-utils
exit

This will cause yum to install the nfs-utils package and several other packages it requires. Reply y when it asks you for permission.

A reboot might be needed after the install, I had trouble with rpcbind and thus rcp.statd not starting up and NFS mounts thus fail with: "mount.nfs: rpc.statd is not running but is required for remote locking". Doing a:
service rpcbind restart
service nfslock restart
service nfs restart
might also be enough to fix this.
-- Grumbel

Authorizing your XO-1 for NFS

On your NFS server, add a line to the /etc/exports file and reload nfs:

su -
echo "/home/johndoe 192.168.1.250(ro,no_root_squash)" >> /etc/exports
service nfs reload
exit

The items in parentheses are options. The value ro means read-only; your server will not allow the XO to modify files in the /home/johndoe directory. The value no_root_squash means your server will skip numeric-userid checking. For a full explanation, do man exports on your NFS server.

Mounting

You use the mount command as usual to mount files that reside physically on an NFS server, mount device mountpoint, but the device parameter has a special form: host:directory, that is, the NFS server's hostname or IP Address, a colon, and the directory to be mounted:

mount nfs-server.mynetwork.com:directory mount-point

Mounting /home/johndoe on your XO-1

On your XO-1 laptop, in Terminal ActivityActivity-terminal.svg, mount the remote directory:

su -
mount 192.168.1.2:/home/johndoe /mnt
exit

Using NFS mounts

Refer to files and directories of a NFS-mounted filesystem by mount-point, just as if they resided on your XO-1 laptop.

Using NFS-mounted files on your XO-1

Suppose that /home/johndoe/public_html/index.html is the index to John Doe's webpage. In the Browse ActivityActivity-web.svg, give this as the location you wish to browse to:

file:///mnt/public_html/index.html