FOSSILCONS(8)                                       FOSSILCONS(8)

     NAME
          fossilcons - fossil console commands

     SYNOPSIS
          con /srv/fscons

          . file
          9p T-message
          bind [ -b|-a|-c|-bc|-ac ] new old
          dflag
          echo [ -n ] [ arg ]
          listen [ -INd ] [ address ]
          msg [ -m nmsg ] [ -p nproc ]
          printconfig
          srv [ -APWdp ] name
          uname name [ id | :id | %newname | =leader | +member |
          -member ]
          users [ -d | -r file ] [ -w ]
          who

          fsys name
          fsys name config [ device ]
          fsys name venti [ host ]
          fsys name open [ -APVWar ] [ -c ncache ]
          [ fsys name ] close
          fsys name unconfig

          [ fsys name ] bfree addr
          [ fsys name ] block addr offset [ count [ data ]]
          [ fsys name ] check [ pblock ] [ pdir ] [ pfile ] [ bclose ]
                    [ clri ] [ clre ] [ clrp ] [ fix ] [ venti ] [
                    snapshot ]
          [ fsys name ] clre addr offsets ...
          [ fsys name ] clri files ...
          [ fsys name ] clrp addr offset ...
          [ fsys name ] create path uid gid perm
          [ fsys name ] df
          [ fsys name ] epoch [[ -ry ] n ]
          [ fsys name ] halt
          [ fsys name ] label addr [ type state epoch epochclose tag ]
          [ fsys name ] remove files ...
          [ fsys name ] snap [ -a ] [ -s src ] [ -d dst ]
          [ fsys name ] snapclean [ timeout ]
          [ fsys name ] snaptime [ -a hhmm ] [ -s interval ] [ -t
          timeout ]
          [ fsys name ] stat files...
          [ fsys name ] sync
          [ fsys name ] unhalt
          [ fsys name ] vac dir
          [ fsys name ] wstat file elem uid gid perm length

     Page 1                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

     DESCRIPTION
          These are configuration and maintenance commands executed at
          the console of a fossil(4) file server.  The commands are
          split into three groups above: file server configuration,
          file system configuration, and file system maintenance.
          This manual page is split in the same way.

        File server configuration
          The dot (.)  command reads file, treating each line as a
          command to be executed.  Blank lines and lines beginning
          with a `#' character are ignored.  Errors during execution
          are printed but do not stop the script.  Note that file is a
          file in the name space in which fossil was started, not a
          file in any file system served by fossil.

          9p executes a 9P transaction; the arguments are in the same
          format used by 9pcon(8).

          Bind behaves similarly to bind(1). It is useful when fossil
          is started without devices it needs configured into its
          namespace.

          Dflag toggles the debug flag and prints the new setting.
          When the debug flag is set, all protocol messages and infor-
          mation about authentication is printed to standard error.

          Echo behaves identically to echo(1), writing to the console.

          Listen manages the network addresses at which fossil is lis-
          tening.  With no arguments, listen prints the current list
          of addresses and their network directories.  With one argu-
          ment, listen address starts a new listener at address; the
          -d flag causes listen to remove the listener at the given
          address.  By default, the user none is only allowed to
          attach on a connection after at least one other user has
          successfully attached.  The -N flag allows connections from
          none at any time.  The -I flag causes fossil to check the IP
          address of incoming connections against /mnt/ipok, rejecting
          attaches from disallowed addresses.  This mechanism is not
          intended for general use.  The server sources.cs.bell-
          labs.com uses it to comply with U.S. crytography export reg-
          ulations.

          Msg prints the maximum internal 9P message queue size and
          the maximum number of 9P processes to allocate for serving
          the queue.  The -m and -p options set the two variables.

          Printconfig prints the config line for each configured file
          system and prints the venti line, if any, used to configure
          this file server.

          Srv behaves like listen but uses /srv/name rather than a

     Page 2                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

          network address.  With the -p flag, srv edits a list of con-
          sole services rather than 9P services.  With no arguments,
          srv prints the current list of services.  With one argument,
          srv name starts a new service at /srv/name; the -d flag
          causes srv to remove the named service.  See the [fsys] open
          command below for a description of the -APW options.

          Uname manipulates entries in the user table.  There is no
          distinction between users and groups: a user is a group with
          one member.  For each user, the user table records:

          id       the string used to represent this user in the on-
                   disk structures

          name     the string used to represent this user in the 9P
                   protocol

          leader   the group's leader (see stat(5) for a description
                   of the special privileges held by a group leader)

          members  a comma-separated list of members in this group

          The id and name are usually the same string, but need not
          be.  Once an id is used in file system structures archived
          to Venti, it is impossible to change those disk structures,
          and thus impossible to rename the id. The translation from
          name to id allows the appearance of renaming the user even
          though the on-disk structures still record the old name.
          (In a conventional Unix file system, the id is stored as a
          small integer rather than a string.)  Leader and members are
          names, not ids.

          The first argument to uname is the name of a user.  The sec-
          ond argument is a verb, one of:

          id        create a user with name `name' and id `id;' also
                    create a home directory /active/usr/uname

          :id       create a user with name `name' and id `id,' but do
                    not create a home directory

          %newname  rename user `name' to `newname,' throughout the
                    user table

          =leader   set name's group leader to leader.

          =         remove name's group leader; then all members will
                    be considered leaders

          +member   add member to name's list of members

     Page 3                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

          -member   remove member from name's list of members

          If the verb is omitted, the entire entry for name is
          printed, in the form `id:name:leader:members.'

          The end of this manual page gives examples.

          Users manipulates the user table.  The user table is a list
          of lines in the form printed by the uname command.  The -d
          flag resets the user table with the default:

               adm:adm:adm:sys
               none:none::
               noworld:noworld::
               sys:sys::
               glenda:glenda:glenda:

          Except glenda, these users are mandatory: they must appear
          in all user files and cannot be renamed.

          The -r flag reads a user table from the named file in file
          system main.  The -w flag writes the table to
          /active/adm/users on the file system main.  /active/adm and
          /active/adm/users will be created if they do not exist.

          Users -r /active/adm/users is automatically executed when
          the file system main is opened.

          Users -w is automatically executed after each change to the
          user table by the uname command.

          Who prints a list of users attached to each active connec-
          tion.

        File system configuration
          Fsys sets the current file system to name, which must be
          configured and open (q.v.).  The current file system name is
          displayed as the file server prompt.  The special name all
          stands for all file systems; commands applied to all are
          applied to each file system in turn.  The commands config,
          open, venti, and close cannot be applied to all.

          Fsys takes as an optional argument (after name) a command to
          execute on the named file system.  Most commands require
          that the named file system be configured and open; these
          commands can be invoked without the fsys name prefix, in
          which case the current file system is used.  A few commands
          (config, open, and unconfig) operate on unopened file sys-
          tems; they require the prefix.

          Config creates a new file system named name using disk file
          device. This just adds an entry to fossil's internal table.

     Page 4                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

          If device is missing, the file argument to fossil's -f
          option will be used instead; this allows the fossil configu-
          ration file to avoid naming the partition that it is embed-
          ded in, making it more portable.

          Venti establishes a connection to the Venti server host (by
          default, the environment variable $venti or the network
          variable $venti) for use by the named file system.  If no
          venti command is issued before open, the default Venti
          server will be used.  If the file system is open, and was
          not opened with the -V flag, the command redials the Venti
          server.  This can be used to reestablish broken connections.
          It is not a good idea to use the command to switch between
          Venti servers, since Fossil does not keep track of which
          blocks are stored on which servers.

          Open opens the file system, reading the root and super
          blocks and allocating an in-memory cache for disk and Venti
          blocks.  The options are:

          -A         run with no authentication

          -P         run with no permission checking

          -V         do not attempt to connect to a Venti server

          -W         allow wstat to make arbitrary changes to the user
                     and group fields

          -a         do not update file access times; primarily to
                     avoid wear on flash memories

          -r         open the file system read-only

          -c ncache  allocate an in-memory cache of ncache (by
                     default, 1000) blocks

          The -APW settings can be overridden on a per-connection
          basis by the srv command above.

          Close flushes all dirty file system blocks to disk and then
          closes the device file.

          Unconfig removes the named file system (which must be
          closed) from fossil's internal table.

        File system maintenance
          Bfree marks the block at disk address addr as available for
          allocation.  Before doing so, it prints a label command
          (q.v.)  that can be used to restore the block to its previ-
          ous state.

     Page 5                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

          Block displays (in hexadecimal) the contents of the block at
          disk address addr, starting at offset and continuing for
          count bytes or until the end of the block.  If data (also
          hexadecimal) is given, the contents in that range are
          replaced with data.  When writing to a block, block prints
          the old and new contents, so that the change is easily
          undone.  Editing blocks is discouraged.

          Clre zeros an entry from a disk block.  Before doing so, it
          prints a block command that can be used to restore the
          entry.

          Clri removes the internal directory entry and abandons stor-
          age associated with files. It ignores the usual rules for
          sanity, such as checking against removing a non-empty direc-
          tory.  A subsequent flchk (see fossil(4)) will identify the
          abandoned storage so it can be reclaimed with bfree com-
          mands.

          Clrp zeros a pointer in a disk block.  Before doing so, it
          prints a block command that can be used to restore the
          entry.

          Check checks the file system for various inconsistencies.
          If the file system is not already halted, it is halted for
          the duration of the check.  If the archiver is currently
          sending a snapshot to Venti, the check will refuse to run;
          the only recourse is to wait for the archiver to finish.

          A list of keyword options control the check.  The pblock,
          pdir, and pfile options cause check to print the name of
          each block, directory, or file encountered.

          By default, check reports errors but does not fix them.  The
          bclose, clri, clre, and clrp options specify correcting
          actions that may be taken: closing leaked blocks, clearing
          bad file directory entries, clearing bad pointers, and
          clearing bad entries.  The fix option enables all of these;
          it is equivalent to bclose clri clre clrp.

          By default, check scans the portion of the active file sys-
          tem held in the write buffer, avoiding blocks stored on
          Venti or used only in snapshots.  The venti option causes
          check to scan the portion of the file system stored on
          Venti, and the snapshot option causes check to scan old
          snapshots.  Specifying snapshot causes check to take a long
          time; specifying venti or (worse) venti snapshot causes
          check to take a very long time.

          Create creates a file on the current file system.  Uid and
          gid are uids (not unames; see the discussion above, in the
          description of the uname command).  Perm is the low 9 bits

     Page 6                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

          of the permission mode of the file, in octal.  The a, d, and
          l mode prefixes set the append-only, directory, and lock
          bits.  The perm is formatted as described in the stat com-
          mand; creating files or directories with the snapshot(s) bit
          set is not allowed.

          Df prints the amount of used disk space in the write buffer.

          Epoch sets the low file system epoch.  Snapshots in the file
          system are given increasing epoch numbers.  The file system
          maintains a low and a high epoch number, and only allows
          access to snapshots in that range.  The low epoch number can
          be moved forward to discard old snapshots and reclaim the
          disk space they occupy.  (The high epoch number is always
          the epoch of the currently active file system.)

          With no argument epoch reports the current low and high
          epoch numbers.  The command ``epoch n'' is used to propose
          changing the low epoch to n. In response, fossil scans
          /archive and /snapshot for snapshots that would be dis-
          carded, printing their epoch numbers and the clri commands
          necessary to remove them.  The epoch is changed only if no
          such paths are found.  The usual sequence of commands is (1)
          run epoch to print the snapshots and their epochs, (2) clri
          some snapshots, (3) run epoch again.  If the file system is
          completely full (there are no free blocks), clri may fail
          because it needs to allocate blocks.  For this situation,
          the -y flag to epoch forces the epoch change even when it
          means discarding currently accessible snapshots.  Note that
          when there are still snapshots in /archive, the archiver
          should take care of those snapshots (moving the blocks from
          disk to Venti) if you give it more time.

          The -r flag to epoch causes it to remove any now-
          inaccessible snapshot directories once it has changed the
          epoch.  This flag only makes sense in conjunction with the
          -y flag.

          Epoch is a very low-level way to retire snapshots.  The pre-
          ferred way is by setting an automatic timer with snaptime.

          Halt suspends all file system activity; unhalt resumes
          activity.

          Label displays and edits the label associated with a block.
          When editing, a parameter of - means leave that field
          unchanged.  Editing labels is discouraged.

          Remove removes files.

          Snap takes a temporary snapshot of the current file system,
          recording it in /snapshot/yyyy/mmdd/hhmm as described in

     Page 7                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

          fossil(4). The -a flag causes snap to take an archival snap-
          shot, recording it in /archive/yyyy/mmdd, also described in
          fossil(4). By default the snapshot is taken of /active, the
          root of the active file system.  The -s flag specifies a
          different source path.  The -d flag specifies a different
          destination path.  These  two flags are useful together for
          moving snapshots into the archive tree.

          Snapclean immediately discards all snapshots that are more
          than timeout minutes old.  The default timeout is the one
          set by the snaptime command.  The discarding is a one-time
          event rather than a recurring event as in snaptime.

          Snaptime displays and edits the times at which snapshots are
          automatically taken.  An archival snapshot is taken once a
          day, at hhmm, while temporary snapshots are taken at multi-
          ples of interval minutes.  Temporary snapshots are discarded
          after they are timeout minutes old.  The snapshot cleanup
          runs every timeout minutes or once a day, whichever is more
          frequent, so snapshots may grow to an age of almost twice
          the timeout before actually being discarded.  With no argu-
          ments, snaptime prints the current snapshot times.  The -a
          and -s options set the archive and snapshot times.  An hhmm
          or interval of `none' can be used to disable that kind of
          automatic snapshot.  The -t option sets the snapshot time-
          out.  If timeout is `none', temporary snapshots are not
          automatically discarded.  By default, all three times are
          set to `none'.

          Stat displays metadata for each of the named files, in the
          form:

               stat file elem uid gid perm length

          (Replacing stat with wstat yields a valid command.)  The
          perm is an octal number less than or equal to 777, prefixed
          with any of the following letters to indicate additional
          bits.

               a   append only
               d   directory
               l   exclusive use
               s   is the root of a snapshot
               t   temporary bit
               A   MS-DOS archive bit
               G   setgid
               H   MS-DOS hidden bit
               L   symbolic link
               S   MS-DOS system bit
               U   setuid
               Y   sticky

     Page 8                       Plan 9            (printed 12/21/24)

     FOSSILCONS(8)                                       FOSSILCONS(8)

          The bits denoted by capital letters are included to support
          non-Plan 9 systems.  They are not made visible by the 9P
          protocol.

          Sync writes dirty blocks in memory to the disk.

          Vac prints the Venti score for a vac(1) archive containing
          the tree rooted at dir, which must already be archived to
          Venti (typically dir is a directory in the /archive tree).

          Wstat changes the metadata of the named file. Specifying -
          for any of the fields means ``don't change.''  Attempts to
          change the d or s bits in the perm are silently ignored.

     EXAMPLES
          Sources, the Plan 9 distribution file server, uses the fol-
          lowing configuration file:

               srv -p fscons.sources
               srv -p fscons.sources.adduserd
               srv sources
               fsys main config /dev/sdC0/fossil.outside
               fsys main open -c 25600
               fsys main
               users /active/adm/users
               listen tcp!*!564
               msg -m 40 -p 10
               snaptime -a 0000 -s 15

          The second console is used by the daemon that creates new
          accounts.

          To add a new user with name and id rob and create his home
          directory:

               uname rob rob

          To create a new group sys (with no home directory) and add
          rob to it:

               uname sys :sys
               uname sys +rob

          To save an old (but not yet discarded) snapshot into the
          archive tree:

               snap -a -s /snapshot/2003/1220/0700 -d /archive/2003/1220

     Page 9                       Plan 9            (printed 12/21/24)