mkfs(1M) mkfs(1M)
NAME
mkfs - construct a file system
SYNOPSIS
/etc/mkfs special blocks[:inodes] [gap blocks/cyl]
/etc/mkfs special proto [gap blocks/cyl]
DESCRIPTION
mkfs constructs a file system by writing on the special file
according to the directions found in the remainder of the
command line. The command waits 10 seconds before starting
to construct the file system. If the second argument is
given as a string of digits, mkfs builds a file system with
a single empty directory on it. The size of the file system
is the value of blocks interpreted as a decimal number. This
is the number of physical disk blocks the file system will
occupy. The boot program is left uninitialized. If the
optional number of inodes is not given, the default is the
number of logical blocks divided by 4.
If the second argument is a file name that can be opened,
mkfs assumes it to be a prototype file proto, and will take
its directions from that file. The prototype file contains
tokens separated by spaces or newlines. The first token is
the name of a file to be copied onto block zero as the
bootstrap program. The second token is a number specifying
the size of the created file system in physical disk blocks.
Typically it will be the number of blocks on the device,
perhaps diminished by space for swapping. The next token is
the number of inodes in the file system. The maximum number
of inodes configurable is 65500. The next set of tokens
comprise the specification for the root file. File
specifications consist of tokens giving the mode, the user
ID, the group ID, and the initial contents of the file. The
syntax of the contents field depends on the mode.
The mode token for a file is a 6-character string. The
first character specifies the type of the file. (The
characters -bcd specify regular, block special, character
special and directory files respectively.) The second
character of the type is either u or - to specify set-user-
id mode or not. The third is g or - for the set-group-id
mode. The rest of the mode is a three digit octal number
giving the owner, group, and other read, write, execute
permissions (see chmod(1)).
Two decimal number tokens come after the mode; they specify
the user and group IDs of the owner of the file.
If the file is a regular file, the next token is a pathname
whence the contents and size are copied. If the file is a
block or character special file, two decimal number tokens
Page 1 (last mod. 1/15/87)
mkfs(1M) mkfs(1M)
follow which give the major and minor device numbers. If
the file is a directory, mkfs makes the entries . and ..
and then reads a list of names and (recursively) files
specifications for the entries in the directory. The scan
is terminated with the token $.
A sample prototype specification follows:
/stand/diskboot
4872 110
d--777 3 1
usr d--777 3 1
sh ---755 3 1 /bin/sh
ken d--755 6 1
$
b0 b--644 3 1 0 0
c0 c--644 3 1 0 0
$
$
In both command syntaxes, the rotational gap and the number
of blocks/cyl can be specified.
The default will be used if the supplied gap and blocks/cyl
are considered illegal values or if a short argument count
occurs.
EXAMPLE
mkfs /dev/fd0 2000 7 50
makes a file system in which 2000 is the total size of the
file system to be put on /dev/fd0; 7 is a sector interleave
number which is used to stagger the disk blocks for more
rapid reading, every 7 blocks, and 50 is a modulo operator
that forces the sector interlace number first to allocate
all blocks in the first 50 sectors, then the next 50, etc.
Note: The proper selection of the m and n parameters can
improve disk efficiency. Disks which have full or partial
track buffering should specify a m and n of 1 and 1; m and n
for other disks must be determined by trial and error as the
disk latency is related to rotational latency and cpu speed.
FILES
/etc/mkfs
SEE ALSO
chmod(1), dir(4), fs(4), boot(8).
BUGS
If a prototype is used, it is not possible to initialize a
file larger than 64K bytes, nor is there a way to specify
Page 2 (last mod. 1/15/87)
mkfs(1M) mkfs(1M)
links.
Page 3 (last mod. 1/15/87)