NAME
mkfs, mkext – archive or update a file system

SYNOPSIS
disk/mkfs [–aprvoxU] [–d root] [–s source] [–z n] proto ...

disk/mkext [–d name] [–u] [–h] [–v] [–x] [–T] file ...

DESCRIPTION
Mkfs copies files from the file tree source (default /) to a new file system root (default /n/newfs). The proto files are read (see proto(2) for their format) and any files specified in them that are out of date are copied.

Mkfs copies only those files that are out of date. Such a file is first copied into a temporary file in the appropriate destination directory and then moved to the destination file. Files that are not specified in the proto file are not updated and not removed.

The options to mkfs are:
a          Instead of writing to new file system, write an archive file to standard output, suitable for mkext. All files in proto, not just those out of date, are archived.
x          For use with –a, this option writes a list of file names, dates, and sizes to standard output rather than producing an archive file.
o          Similar to –x above, but produces a list of source file names to standard output rather than producing an archive file.
d root      Copy files into the tree rooted at root (default /n/newfs). This option suppresses setting the uid and gid fields when copying files. Use –U to reenable it.
p          Update the permissions of a file even if it is up to date.
U          Update of uid and gid of the target files.
r          Copy all files.
s source    Copy from files rooted at the tree source.
v          Print the names of all of the files as they are copied.
z n        Copy files assuming block size n (default 1024) bytes long. If a block contains only 0–valued bytes, it is not copied.

Mkext unpacks archive files made by the –a option of mkfs. Each file on the command line is unpacked in one pass through the archive. If the file is a directory, all files and subdirectories of that directory are also unpacked. When a file is unpacked, the entire path is created if it does not exist. If no files are specified, the entire archive is unpacked; in this case, missing intermediate directories are not created. The options are:
d     specifies a directory (default /) to serve as the root of the unpacked file system.
u     sets the owners of the files created to correspond to those in the archive and restores the modification times of the files.
T     restores only the modification times of the files.
v     prints the names and sizes of files as they are extracted.
h     prints headers for the files on standard output instead of unpacking the files.

EXAMPLES

Make an archive to establish a new file system:
disk/mkfs –a –s dist proto > arch

Unpack that archive onto a new file system:
srv newfs
mount –c /srv/newfs /n/newfs
disk/mkext –u –d /n/newfs < arch

SOURCE
/sys/src/cmd/disk/mkfs.c
/sys/src/cmd/disk/mkext.c

SEE ALSO
prep(8), sd(3), tar(1)