NAME

fsconfig – configuring a file server

SYNOPSIS

service name
config device
nvram device
filsys name device
ip ipaddr
ipflag flags
ipgw ipaddr
ipmask ipaddr
ipsntp ipaddr
ream name
recover name
readonly
noattach
halt
end

DESCRIPTION

When a file server's configuration has not been set, or by explicit request early in the server's initialization (see fs(8)), the server enters `config mode'. The commands described here apply only in that mode. They establish configuration constants that are typically valid for the life of the server, and therefore need be run only once. If the non–volatile RAM on the server gets erased, it will be necessary to recreate the configuration.

Syntax
In these commands, ipaddr is an IP address in the form 111.103.94.19 and name is a text string without white space. The syntax of a device is more complicated:
wn1.n2.n3

Defines a SCSI disk on target (unit) id n2, controller (host adapter) n1, and LUN (logical unit number) n3. A single number specifies a target, while two numbers specify target.lun, with the missing numbers defaulting to zero. Any one of the numbers may be replaced by <m–n> to represent the values m through n inclusive. M may be greater than n. For example, (w<1–4>) is the concatenation of SCSI targets 1 through 4.
hn1.n2.n3
Defines an ATA disk similar to w. Lun is ignored. Target 0 is an IDE master and 1 is a slave. Instead of specifying controller and target separately, one may omit the controller and specify a target of controller–number*2 + target–number, thus h2 is equivalent to h1.0.0 (second IDE controller, master drive).
mn1.n2.n3
Define a Marvell 88SX[56]0[48][01] disk similer to w. Hot–swapping drives is supported. Similar target naming rules apply as for IDE controllers. However the controller–number is multiplied by the number of drives the controller supports rather than 2. Thus m9 is equivalent to m1.1.0 (second controller, second drive), if the first controller supports 8 drives.
an1.n2.n3
Define an AHCI disk similer to m.
en1.n2
Specify an AoE target. n1 is the shelf while n2 is the slot. Luns are not used for AoE targets.
(device...)
A pseudo–device formed from the concatenation of the devices in the list. The devices are not blank– or comma–separated.
[device...]
A pseudo–device formed from the block–wise interleaving of the devices in the list. The size of the result is the number of devices times the size of the smallest device.
{device...}
A pseudo–device formed from the mirroring of the first device in the list onto all the others. The size of the result is the size of the smallest device. One might think of this as RAID 1 without recovery, and [ ] as RAID 0. Each block is written to all the devices, starting with the rightmost in the list and working leftward. A block is read from the first device that provides it without error, starting with the leftmost in the list and working rightward.
pdevice.n1.n2
Partition device. If n1 is less than 101, then A partition starting at n1% from the beginning of device with a length n2% of the size of the device. Otherwise, n1 is the absolute starting block number and n2 is the absolute ending block number. Blocks are RBUFSIZE bytes. This is a file server compile–time constant, usually 8192 bytes. It is recommended that AoE targets not be partitioned by percentage as a replaced drive might not have exactly the same number of blocks. Parenthesize device if it contains periods.
pdevice"partname"
Partition device with named partition. Both fdisk and prep(8) partitions are supported. Prep partitons have their given name. Fdisk partitions are named as in 9load(8). Thus the first dos partition is named "dos," the first Plan 9 partition is named "plan9" and the nth Plan 9 partition is named "plan9.n."
xdevice
A pseudo–device that contains the byte–swapped contents of device. Since the file server writes integers to disk in its native byte order, it can be necessary to use this device to read file systems written by processors of the other byte order.
fdevice
A pseudo–WORM disk: blocks on device can be written only once and may not be read unless written. A pseudo–WORM is intended for debugging. It can be a source of consternation if the size of the underlying device changes by a few blocks as the blocks–written bitmap is kept at an offset from the end of the device.
cdevice1device2
A cached WORM. The first device is the cache, the second the WORM.
o     (Letter o) The read–only (dump) file system of the most–recently defined cached WORM file system.

Configuration
The service command sets the textual name of the server as known in the network databases.

The configuration information is stored in block zero on a device whose device string is written in non–volatile RAM. The config and nvram commands identify the device on which the information is recorded. The config command also erases any previous configuration.
The filsys command configures a file system on device and calls it name. Name is used as the specifier in attach messages to connect to that file system. (The file system main is the one attached to if the specifier is null; see attach(5)).
The rest of the configuration commands record IP addresses: the file server's address (ip), the local gateway (ipgw), the local netmask (ipmask), the local interface flags (ipflag), and the address of a system running an SNTP server (ipsntp). ip, ipgw and ipmask to indicate the interface number; zero is the default. Ipflag may allow running cec(8) (cec), AoE (aoe), and AoE jumbo frames (aoejumbo).

One–time actions

The ream command initializes the named file system. It overwrites any previous file system on the same device and creates an empty root directory on the device.
For the recover command, the named file system must be a cached WORM. Recover clears the associated magnetic cache and initializes the file system, effectively resetting its contents to the last dump.
Readonly disables all writing to all devices. This is useful for trying dangerous experiments.
Noattach prevents attaches.
Halt will cause the server to immediately exit and reboot.
The various configuration commands only record what to do; they write no data to disk. The command end exits config mode and begins running the file server proper. The server will then perform whatever I/O is required to establish the configuration.

EXAMPLE

Initialize a file server kgbsun with a single file system interleaved between SCSI targets 3 and 4.
service kgbsun
config w3
filsys main [w<3–4>]
ream main
Initialize a file server kremvax with a single disk on target 0 partitioned as a cached pseudo–WORM file system with the cache on the third quarter of the drive and the pseudo–WORM on the interleave of the first, second, and fourth quarters. The performance of this example will be poor due to seek conflict between the cache and pseudo–WORM.
service kremvax
config p(w0)50.1
filsys main cp(w0)50.25[p(w0)0.25p(w0)25.25p(w0)75.25]
filsys dump o
ream main
A complete and complex example: initialize a file server ila with a single AoE target on e565.2 for a scratch file system, a cached pseudo–WORM file system with cache on 25GB of target e565.0 and worm mirrored on targets e565.1 and e565.1. It has two ethernet interfaces. Interface 0 is used for client connections and a connection to shelf 545. Interface 1 is a point–to–point link to shelf 565 and allows jumbo frames. Cec(8) is allowed on both interfaces. The SMTP server is global to the system. SMTP uses routing to determine how to contact the server.
config p(a5)95.5
service ila
filsys main cp(e565.0)0.3276800{e565.1e545.1}
filsys dump o
filsys other e565.2
ipsmtp 128.192.1.9
ip0 205.185.197.7
ipgw0 206.186.197.254
ipmask0 255.255.255.0
ipflag0 cec aoe
ip1 205.185.197.106
ipgw1 205.185.197.254
ipmask1 255.255.255.0
ipflag1 cec aoe aoejumbo
end
The plan9.ini(8) for this server is as follows
console=0
bootfile=sdC0!9fat!9ilafs
ether0=type=m10g
ether1=type=m10g
nvr=hd!0!9fat!fs.nvr
*nodumpstack=0

SOURCE

/sys/src/fs/port/config.c

SEE ALSO

fs(8), mkfsconf(8)
Ken Thompson, ``The Plan 9 File Server''.
Sean Quinlan, ``A Cached WORM File System'', Software – Practice and Experience, December, 1991
Erik Quanstrom ``The Diskless Fileserver'', Procedings of IWP92, December, 2007.