CWFS(4) CWFS(4) NAME cwfs - cached-worm file server, dump SYNOPSIS cwfs [ -cf ] [ -a announce-string ] ... [ -m device-map ] config-device DESCRIPTION Cwfs is a cached-worm file server that runs as a user-mode program and can maintain file systems created by fs(4), the original Plan 9 file server that had its own kernel and operated a standalone system with disks and optical-disc jukebox attached. Unlike fs(4), which could only accept 9P connections over IL/IPv4 on Ethernets (or over Datakit and Cyclones, long ago), cwfs accepts 9P connections over any network medium and protocol that it can announce on, by default TCP (over IPv4 or IPv6). Given suitable 9P clients, one could even run 9P over aan(8) or tls(3). The stock cwfs implements a 16K file system block size and 32-bit disk addresses, in order to be compatible with some existing file systems, notably emelie's. These parameters can be changed by recompilation. Cwfs expects to find the configuration block on config- device. Options are: -a announce on announce-string instead of `tcp!*!9fs'. -c use a newer, faster, and incompatible cache-device lay- out. To convert an old file system's cache to the new layout, dump the file system, note the last superblock number, halt cwfs, restart cwfs with -cf, recover the file system, and start cwfs with -c thereafter. -f enter the file server's configuration mode before start- ing normal operation. -m the file device-map contains a simple device name (e.g., `w9') and a replacement per line. The device name is in the usual filsys notation of fsconfig(8). The replace- ment can be the name of an existing file (which cwfs will not grow) or another such device name. For exam- ple, the file w0 /tmp/w0 h1 w2 would map accesses to device `w0' to existing file `/tmp/w0' and accesses to device `h1' to device `w2', if no file named `w2' exists. CWFS(4) CWFS(4) The file server normally requires all users except `none' to provide authentication tickets on each attach(5). This can be disabled using the noauth configuration command (see fsconfig(8)). The group numbered 9999, normally called noworld, is special on the file server. Any user belonging to that group has attenuated access privileges. Specifically, when checking such a user's access to files, the file's permission bits are first ANDed with 0770 for normal files or 0771 for directories. The effect is to deny world access permissions to noworld users, except when walking directories. The user none is always allowed to attach to emelie without authentication but has minimal permissions. Emelie maintains three file systems on a combination of disks and write-once-read-many (WORM) magneto-optical disks. other is a simple disk-based file system similar to kfs(4). main is a worm-based file system with a disk-based look- aside cache. The disk cache holds modified worm blocks to overcome the write-once property of the worm. The cache also holds recently accessed non-modified blocks to speed up the effective access time of the worm. Occasionally (usually daily at 5AM) the modified blocks in the disk cache are dumped. At this time, traffic to the file system is halted and the modified blocks are relabeled to the unwritten portion of the worm. After the dump, the file system traffic is continued and the relabeled blocks are copied to the worm by a background process. dump Each time the main file system is dumped, its root is appended to a subdirectory of the dump file system. Since the dump file system is not mirrored with a disk cache, it is read-only. The name of the newly added root is created from the date of the dump: /yyyy/mmdds. Here yyyy is the full year, mm is the month number, dd is the day number and s is a sequence number if more than one dump is done in a day. For the first dump, s is null. For the subsequent dumps s is 1, 2, 3, etc. The root of the main file system that is frozen on the first dump of March 1, 1992 will be named /1992/0301/ in the dump file system. Changes from fs(4) fs(4)'s IP configuration is ignored and the underlying system's is used. CWFS(4) CWFS(4) Various other fs(4) commands have been omitted since they (or equivalents) can now be executed directly on the under- lying CPU server, notably date and passwd (see auth/wrkey). fs(4)'s device names `h' for IDE disks and `m' for Marvell SATA disks are not supported; use -m to map wren devices to appropriate names under /dev/sd*. The file server kernel seems to have scanned PCI buses in reverse order from the other Plan 9 kernels, so systems with multiple SCSI cards may find controller numbering reversed. -m can be used to compensate for this if you don't want to change filsys declarations. The file server kernel's config field in NVRAM was over- loaded in recent times to hold a secstore(1) key for the CPU hostowner. Since cwfs runs on a CPU kernel, the location of its configuration block must be supplied on the command line. Disk labels are now implemented for l devices. At the first access of a side, cwfs will attempt to read the label and verify that it has the correct side number and byte order; if either is wrong, it will issue a warning. If the label cannot be read, cwfs will attempt to write a new label. EXAMPLES Place the root of the dump file system on /n/dump and show the modified times of the MIPS C compiler over all dumps in February, 1992: cwfs w0 9fs dump ls -l /n/dump/1992/02??/mips/bin/vc To get only one line of output for each version of the com- piler: ls -lp /n/dump/1992/02??/mips/bin/vc | uniq SOURCE /sys/src/cmd/cwfs SEE ALSO yesterday(1), fs(3), sd(3), fossil(4), fs(4), srv(4), fs(8), fsconfig(8) Sean Quinlan, ``A Cached WORM File System'', Software - Practice and Experience, December, 1991 Ken Thompson, Geoff Collyer, ``The 64-bit Standalone Plan 9 File Server'' BUGS CWFS(4) CWFS(4) For the moment, the file server serves both the old (9P1) and new (9P2000) versions of 9P, deciding which to serve by sniffing the first packet on each connection. File system block size and disk address size (32- or 64-bit) are fixed at compilation time, and this is not easily changed. Cwfs is probably not the right choice of file server for new file systems. It's intended to cope with existing file sys- tems on optical jukeboxes or images thereof.