xref: /plan9/sys/man/3/fs (revision e06f534bbaa4097bc6f4764ef1dd2dc3338fbd40)
FS 3
NAME
fs - file system devices
SYNOPSIS
 bind -b #k /dev 
 /dev/fs  /dev/fs/ctl  /dev/fs/... 
DESCRIPTION
The fs driver builds complex disk files out of simpler disk files. Inspired by the Plan 9 file server kernel's configuration strings, it provides device mirroring, partitioning, interleaving, and catenation for disk-based services like kfs (8) or venti (8).

The device is intended to be bound at /dev and contains a directory named fs , which in turn contains a ctl file and one file per configured device.

The control messages each introduce a new device, here named new . The file arguments are interpreted in the name space of the writer.

mirror " new files" ... The device new corresponds to a RAID 1 mirroring of files . Writes to new are handled by sequentially writing to the files from right to left (the reverse of the order in the control message). If any write fails, the write is aborted. Reads from new are handled by sequentially reading from the files from left to right until one succeeds. The length of the mirror device is the minimum of the lengths of the files .

part " new file offset length" The device new corresponds to the length bytes starting at offset in file . If offset + length reaches past the end of file , length is silently reduced to fit.

inter " new files" ... The device new corresponds to the block interleaving of files ; an 8192-byte block size is assumed.

cat " new files" ... The device new corresponds to the catenation of files .

If the variable fsconfig is set in plan9.ini (8) then fs will read its configuration from the file $fsconfig on the first attach. This is useful when the machine boots from a local file server that uses fs .

EXAMPLE
Mirror the two disks /dev/sdC0/data and /dev/sdD0/data as /dev/fs/m0 ; similarly, mirror /dev/sdC1/data and /dev/sdD1/data as /dev/fs/m1 :
.EX echo mirror m0 /dev/sdC0/data /dev/sdD0/data >/dev/fs/ctl echo mirror m1 /dev/sdC1/data /dev/sdD1/data >/dev/fs/ctl

Interleave the two mirrored disks to create /dev/fs/data :

.EX echo inter data /dev/fs/m0 /dev/fs/m1 >/dev/fs/ctl

Run kfs (4) on the interleaved device:

.EX disk/kfs -f /dev/fs/data

Save the configuration:

.EX cp /dev/fs/ctl /dev/fd0disk To load the configuration automatically at boot time, add this to plan9.ini :
.EX fsconfig=/dev/fd0disk
"SEE ALSO"
kfs (4), fs (8), plan9.ini (8), venti (8)
SOURCE
/sys/src/9/port/devfs.c