Node:Quick server setup, Next:, Previous:Quick client setup, Up:Getting Started



Quick server setup

Setting up an SFS server is a slightly more complicated process. You must perform at least three steps:

  1. Create a public/private key pair for your server.
  2. Create an /etc/sfs/sfsrwsd_config configuration file.
  3. Configure your machine as an NFS server and export all necessary directories to localhost.

To create a public/private key pair for your server, run the command:

mkdir /etc/sfs
sfskey gen -P /etc/sfs/sfs_host_key

Then you must create an /etc/sfs/sfsrwsd_config file based on which local directories you wish to export and what names those directories should have on clients. This information takes the form of one or more Export directives in the configuration file. Each export directive is a line of the form:

Export local-directory sfs-name

local-directory is the name of a local directory on your system you wish to export. sfs-name is the name you wish that directory to have in SFS, relative to the previous Export directives. The sfs-name of the first Export directive must be /. Subsequent sfs-names must correspond to pathnames that already exist in the previously exported directories.

Suppose, for instance, that you wish to export two directories, /disk/u1 and /disk/u2 as /usr1 and /usr2, respectively. You should create a directory to be the root of the exported namespace, say /var/sfs/root, create the necessary sfs-name subdirectories, and create a corresponding sfsrwsd_config file. You might run the following commands to do this:

% mkdir /var/sfs/root
% mkdir /var/sfs/root/usr1
% mkdir /var/sfs/root/usr2

and create the following sfsrwsd_config file:

Export /var/sfs/root /
Export /disk/u1 /usr1
Export /disk/u2 /usr2

Finally, you must export all the local-directorys in your sfsrwsd_config to localhost via NFS version 3. The details of doing this depend heavily on your operating system. For instance, in OpenBSD you must add the following lines to the file /etc/exports and run the command kill -HUP `cat /var/run/mountd.pid`:

/var/sfs/root localhost
/disk/u1 localhost
/disk/u2 localhost

On Linux, the syntax for the exports file is:

/var/sfs/root localhost(rw)
/disk/u1 localhost(rw)
/disk/u2 localhost(rw)

On Solaris, add the following lines to the file /etc/dfs/dfstab and run exportfs -a:

share -F nfs -o -rw=localhost /var/sfs/root
share -F nfs -o -rw=localhost /disk/u1
share -F nfs -o -rw=localhost /disk/u2

In general, the procedure for exporting NFS file systems varies greatly between operating systems. Check your operating system's NFS documentation for details. (The manual page for mountd is a good place to start.)

Once you have generated a host key, created an sfsrwsd_config file, and reconfigured your NFS server, you can start the SFS server by running sfssd. Note that a lot can go wrong in setting up an SFS server. Thus, we recommend that you first run sfssd -d. The -d switch will leave sfssd in the foreground and send error messages to your terminal. If there are problems, you can then easily kill sfssd from your terminal, fix the problems, and start again. Once things are working, omit the -d flag; sfssd will run in the background and send its output to the system log.

Note: You will not be able to access an SFS server using the same machine as a client unless you run sfscd with the -l flag, sfscd. Attempts to SFS mount a machine on itself will return the error EDEADLK (Resource deadlock avoided).