The Coda HOWTO: Configuring and starting Coda

Next Previous Contents

## 3. Configuring and starting Coda

WARNING:

CODA IS BARELY READY FOR PRODUCTION USE. THIS RELEASE IS JUST FOR THOSE INTERESTED IN EXPLORING THOSE FEATURES WHICH WORK. IT CONTAINS KERNEL CODE, AND SERVERS RUNNING WITH ROOT PRIVILEGES, AND COULD LEAD TO DATA LOSS.

To get Coda running you will go through 3 steps:

1. Get a Coda enabled kernel for the client. (The server does not need a special kernel)
2. Configure and run the client cache manager Venus
3. Configure and run the file server, authentication server and update servers
4. Connect a client to your new server.

## 3.1 Getting a Coda enabled kernel

Before you can use a Coda client you need a new filesystem driver in your kernel. For the most part this driver redirects requests to the user level cache manager venus. Precompiled modules exist for commonly used kernels. If no module exists for you, you'll find instructions below where to find it.

### Linux

Get a coda-fs-module-k2.?.?-c?.?.?.arch.rpm rpm package and install it. `k2.?.?` should match your kernel version (use uname -a) and `c?.?.?` should match you Coda version.

Linux kernels change often and many people have custom kernels for their environment. Our modules will generally only work on RedHat Linux kernels and you may have to build a module for your kernel. Look at the section building a kernel module.

### FreeBSD

You may obtain a Coda lkm from your FreeBSD distribution:

> `

>     cd /lkm

> `

Check if `coda_mod.o` is there already. Otherwise, you may obtain a Coda lkm from the Coda site:

> `

>     ftp://ftp.coda.cs.cmu.edu/pub/coda/freebsd/3.0-aout/i386/coda_mod.o

> `

You then install the lkm with:

> `

>     modload -v -e coda_mod -o /var/run/lkm.coda /lkm/coda_mod.o

> `

You can build support for the Coda VFS layer into your kernel. This is discussed later in the Building FreeBSD section.

### NetBSD

NOTE: The GENERIC NetBSD kernel should have Coda enabled. Do an:

> `

>     nm -o /netbsd | grep coda_open

> `

If this is present, you are done with this section. PROCEED NO FURTHER

If you need to load an lkm it should be in the NetBSD distribution:

> `

>     cd /usr/lkm

> `

Check if coda.o is there already. Otherwise, you may obtain a Coda lkm from the Coda site:

> `

>     ftp://ftp.coda.cs.cmu.edu/pub/coda/netbsd/current/i386/coda-1_3H.o

> `

You then install the lkm with:

> `

>     modload -v -e coda_lkmentry -o /var/run/lkm.coda /usr/lkm/coda-1_3H.o

> `

You can build support for the Coda VFS layer into your kernel, though this should be automatic. This is discussed later in the Building NetBSD section.

### Windows 95 & NT

The kernel module is part of the Coda client installer.

## 3.2 Linux and the BSD's: running Venus, the client cache manager

These are partial instructions on how to setup and configure the Coda filesystem. Refinements to the setup created here are discussed in http://ftp.coda.cs.cmu.edu/doc/html/manual.html You will probably not need these refinements in the first instance.

The `venus-setup` script does all the hard work, it will setup the coda control files, create `/dev/cfs0` to communicate with the kernel, ... It also initializes a directory for cache files. In your first Coda run we recommend a small cache, say 20MB. The cache size should be at least 10Meg, typically 60-200Meg is used. Do not go above 300Meg. All the files created will be placed under `/usr/coda`. You should make sure that there is enough space in the file system on which `/usr/coda` resides to hold a fully populated cache.

> `

>     venus-setup <comma_separated_host_list> <cache_size_in_kb>

> `

`venus-setup` and `venus` (below) are in `/usr/sbin`. Make sure that `/usr/sbin` is in your path or that you use fully qualified pathnames. We strongly recommend that you try testserver.coda.cs.cmu.edu as the `comma_separated_host_list` first, and keep the cache size to 20000.

NOTE: `venus-setup` will edit `/etc/services` to add some additional services.

The following assumes you are running X-Windows. However, you could run these commands from virtual consoles as well, by omitting the `xterm -e` in front of the commands below.

Start Venus with:

> `

>     venus &

> `

An `-init` flag can be given when `venus` is started; it flushes the local cache contents. `venus-setup` forces an init to happen when venus is first started. The `-init` flag can be given if Coda cannot recover it's cache after a crash, or after editing the `vstab` file manually.

Observe the venus log with:

> `

>     xterm -e tail -f /usr/coda/etc/console

> `

It will tell you when venus has started and give status.

Type:

> `

>     xterm -e codacon &

> `

to see the communications between the Venus and Vice.

It is possible to see the upcalls from the kernel to Venus by turning up logging in Venus, but they are not very interesting. (To turn on minimal debugging, type:

> `

>     vutil -d 1

> `

and then `tail -f /usr/coda/coda.cache/venus.log`.)

To halt venus, type:

> `

>     vutil shutdown
>     umount /coda  (Linux only)

> `

Or you can kill -9 venus, if you must.

NOTES for Linux users:

- Before restarting Venus `/coda` must be unmounted. If umounting `/coda` gives trouble, make sure to exit all process that hang on to Coda, e.g. by having files open or being cd'd into /coda. A utility like `lsof` and `fuser` can help with this.
- `/proc/fs/coda` has interesting Coda statistics.
- You can enable kernel debugging with `vutil -kdebug 4095` and call tracing with `vutil ktrace 1`. The messages appear in `/var/log/messages`

## 3.3 Windows 95: Starting and Configuring a Coda client

During installation you will be prompted for the IP address of your client and of your Coda server(s). Enter this as indicated.

All executables can be found in the directory `C:\usr\coda\bin`

There are two ways to play with Coda:

### CodaStart

The CodaStart pogram is a Win32 windows-based application to control and observe the Windows 95 Coda client. It will be enhanced in the future. For now it provides a convenient way to start Venus.exe and to load the kernel module. It also displays the kernel-venus communication for debugging purposes. Printing the messages can be stopped by unticking the 'Monitor' check box. The button 'Reset' clears the display.

1. When you start Venus for the first time, or you want to reinitialize its cache, tick the 'Init Venus' check box. This will start Venus with the '-init' and '-cf 1500' flag set. To add or override flags use the 'Configure' button. Start Venus by clicking the left 'Start' button. The 'Status' message will tell you 'Running' when Venus starts. Note, Venus is still in the initialization process.
2. Load the kernel module by clicking on the right 'Start' button. If everything is all right you will see the 'Status' message 'Running'.
3. Click the 'Mount' button to mount, when you see the first messages. When you disabled the 'Monitor', check the DOS box in which Venus runs. Venus must have printed 'Venus starting...' before you can 'Mount'.
4. To unmount, press the 'Unmount' button (the 'Mount' button changed to the 'Unmount' button). This will unload the kernel module. If you are unable to unmount Coda with CodaStart try the method described in 'Starting Coda by hand'.
5. See 'Important Note' below, please.

You are now ready to browse through the Coda filesystem using the explorer!

### Starting Coda by hand

1. Type

   > `

   >     relay.exe

   > `

   in a command Window. This is a 32bit DOS application which you can also start by double clicking on the file in explorer.
2. Now start Venus. Type

   > `

   >     venus.exe -cf 1500 -init

   > `

   in a command window. (this gives up to 1500 cache files, try with more if everythings works fine. Initialization will take longer the more cache file you specifiy.)
3. When Venus prints "Venus starting ..." run

   > `

   >     mount.exe N:

   > `

   This maps the Coda filesystem to the `N:` drive.

You are now ready to browse through the Coda filesystem using the explorer!

1. When you want to restart Venus without initializing the cache just run `venus.exe`. If `venus` crashes restarting it is normally all you need to do.
2. If relay crashes you will want to unmount the `N:` drive run:

   > `

   >     unmount.exe

   > `

   This will stop `relay.exe` (if it is still running) and unload `codadev.vxd` which was loaded by `relay.exe`.

### Important Note

NOTE: In some installations the DPMI DOS Extender window suspends when it is not active. In this case untick the window property 'Properties->Misc-> Background->Always Suspend'. If it is unticked, ticking and unticking it again might help. Also untick the 'Termination' flag, to allow Coda to automatically shutdown, when the system shuts down. For your convenience tick the 'Close on Exit' check box in the 'Program' tab.

## 3.4 Codasrv -- the file server

### Configuring your server

To set up an SCM server, you will run a script vice-setup. This script creates configuration files under the `/vice` directory and creates files and directories on your system for storage of file data and metatdata. To answer the questions vice-setup is asking you need to have the following thought through:

file space

  an empty directory (viz /vicepa) where the fileserver will put files. There must be as much free space on this filesystem as the data you wish to store in Coda.

RVM metadata storage

  a file or raw partition for RVM metadata. You can use a file but it will be quite slow on a larger server. This partition must be around 4% of the total size of the files you wish to store under /vicepa (e.g. on a 2GB server we use around 80M of rvm data). For first installations we recommend the default 22M options, and using files for RVM log and data. (NOTE: Windows NT Setup creates the file c:\coda\rvm\DATA. Use this for RVM metadata.)

virtual memory

  The metadata, held in the RVM data file, is memory mapped. You need that amount of space as virtual memory on your system, in addition to virtual memory to run the server ( 6MB) and other software.

RVM transaction log

  a LOG file, preferably a raw partition on a disk by itself. This needs not be large, a few M's are fine. (NOTE: Windows NT Setup creates the file c:\coda\rvm\LOG. Use this for RVM transaction log.)

A server number

  All servers in a coda cell need to have a unique number to identify them. The servername to identifier mappings have to be defined by the administrator in the file `/vice/db/servers` on the SCM. The format of this file is as follows:

  > `

  >          servernameX.domain.name    1
  >          servernameY.domain.name    2
  >          ...

  > `

  There are currently several limitations to which identifiers are actually usable:

  - all numbers must fit in a single byte.
  - 0 and -1 (255) are used in error conditions.
  - 127 is used to identify `replicated volumes'.
  This leaves us with a usable range of 1-126 and 128-245 for server identifiers.

secret tokens

  two secret tokens of _exactly_ 8 characters (eg elephant).

NOTE: you are now ready to run the setup script. We strongly recommend that you stick to default choices offered as configuring a server differently is quite difficult.

Then run:

> `

>     vice-setup

> `

and answer its questions. Note down the commands that vice-setup prints out for you at the end.

Note: For Windows NT you will need the Cygwin B19 Shell which can be started from the "Start" menu. The shell uses the c:\coda directory as the root mountpoint "/".

### Running Vice:

Start the rpc2portmap server, update server, client and the auth server, as well as the fileserver by typing:

Linux

  > `

  >     /etc/rc.d/init.d/auth2.init start
  >     /etc/rc.d/init.d/update.init start
  >     /etc/rc.d/init.d/codasrv.init start

  > `

BSDs

  > `

  >     /etc/rc.vice start

  > `

Windows NT

  > `

  >     codastart

  > `

Now observe the log:

> `

>     xterm -e tail -f  /vice/srv/SrvLog &

> `

The `SrvLog` should show File Server started. If not, you have a problem.

Determine with `ps` that `codasrv`, `auth2`, `rpc2portmap`, `updatesrv` and `updateclnt` are running.

### Making your root volume

During your configuration session, you commmunicated a name for the root volume to the program. This root volume now needs to be craeted: the precise command to do this was printed out by the vice-setup program, below we assume your file space is in `/vicepa`, and your root volume is `coda:root`.

> `

>     createvol_rep coda:root E0000100 /vicepa

> `

NOTE: E0000100 is the Volume Storage Group set up for you by vice-setup. With more servers you can define other groups in /vice/db/VSGDB -- see the Coda User Manual.

## 3.5 Connecting your client to a new Coda server

Now you are ready to point a Venus (client) at this server. You do this by typing

> `

>     venus-setup  server-name cache-szie-in-kb

> `

NOTE: Windows 95 users should type the IP address and not the hostname of the server.

Start Venus as explained above. From the coda client side, the root volume will appear under /coda. To use it you must now authenticate to Coda, since it is write protected.

The vice-setup program installed an administrative Coda user on the server. It has a uid you chose and has been assigned password changeme. You may clog into Coda with this uid:

> `

>     clog "adminuser"

> `

Validate that you have tokens with the `ctokens` utility.

You can now create files in `coda`, because the administrative user is on the access control list (ACL) of the `/coda` directory. Read the next section to find out how to do more with Coda.

Next Previous Contents