MKFS(1M) MKFS(1M)
NAME
mkfs - construct a file system
SYNOPSIS
/etc/mkfs special [proto]
/etc/mkfs special blocks inodes sectors heads cgsize cgalign
ialign [proto]
DESCRIPTION
mkfs constructs a file system by writing on the special file
using the values found in the remaining arguments of the
command line. The command waits 10 seconds before starting
to construct the file system. During this 10-second pause
the command can be aborted by interrupt mkfs.
When the first form of mkfs is used, mkfs seaches /dev for
the volume header device that special uses. Once the volume
header has been examined, mkfs will then proceed to assign
values to the filesystem parameters.
If the second form of mkfs is used, then all the filesystem
parameters must be specified from the command line. Each
argument other than special and proto is interpreted as a
decimal number.
The filesystem parameters are as follows:
blocks is the number of physical (512 byte) disk blocks
the file system will occupy.
inodes is the number of inodes the filesystem should
have as a minimum.
heads is the number of heads on the physical medium.
sectors is the number of sectors per track of the
physical medium.
cgfsize is the size of each cylinder group, in disk
blocks, approximately.
cgalign is the boundary, in disk blocks, that a
cylinder group should be aligned to.
ialign is the boundary, in disk blocks, that each
cylinder groups inode list should be aligned to.
Once mkfs has the filesystem parameters it needs it then
builds a file system containing two directories. The
filesystems root directory is created with one entry, the
lost+found directory. The lost+found directory is filled
with zeros out to approximately 10 disk blocks so as to
allow space for fsck(1M) to reconnect disconnected files.
The boot program block (block zero) is left uninitialized.
If the the optional proto argument is given, mkfs uses it as
a prototype file and will take its directions from that
file. Note that the blocks and inodes specifiers in the
Page 1 (last mod. 8/20/87)
MKFS(1M) MKFS(1M)
proto file are provided for backwards compatibility, but are
otherwise unused. The prototype file contains tokens
separated by spaces or new-lines. A sample prototype
specification follows (line numbers have been added to aid
in the explanation):
1. /stand/diskboot
2. 4872 110
3. d--777 3 1
4. usr d--777 3 1
5. sh ---755 3 1 /bin/sh
6. ken d--755 6 1
7. $
8. b0 b--644 3 1 0 0
9. c0 c--644 3 1 0 0
10 fifo p--644 3 1
11 slink l--644 3 1 /a/symbolic/link
12 $
13. $
Line 1 in the example is the name of a file to be copied
onto block zero as the bootstrap program.
Line 2 specifies the number of physical (512 byte) blocks
the file system is to occupy and the number of i-nodes in
the file system. These values are ignored.
Lines 3-11 tell mkfs about files and directories to be
included in this file system.
Line 3 specifies the root directory.
lines 4-6 and 8-11 specifies other directories and files.
The $ on line 7 tells mkfs to end the branch of the file
system it is on, and continue from the next higher
directory. The $ on lines 12 and 13 end the process, since
no additional specifications follow.
File specifications give the mode, the user ID, the group
ID, and the initial contents of the file. Valid syntax for
the contents field depends on the first character of the
mode.
The mode for a file is specified by a 6-character string.
The first character specifies the type of the file. The
character range is -bcdpl to specify regular, block special,
character special, directory files, named pipes (fifos) and
symbolic links, respectively. The second character of the
mode 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 3 digit octal number giving the owner, group,
Page 2 (last mod. 8/20/87)
MKFS(1M) MKFS(1M)
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 of the
specification may be a path name whence the contents and
size are copied. If the file is a block or character
special file, two decimal numbers follow which give the
major and minor device numbers. If the file is a symbolic
link, the next token of the specification is used as the
contents of the link. If the file is a directory, mkfs
makes the entries . and .. and then reads a list of names
and (recursively) file specifications for the entries in the
directory. As noted above, the scan is terminated with the
token $.
SEE ALSO
chmod(1) in the User's Reference Manual.
dir(4), fs(4) in the Programmer's Reference Manual.
BUGS
With a prototype file, it is not possible to copy in a file
which requires indirect extents, nor is there a way to
specify hard links.
ORIGIN
AT&T V.3
Page 3 (last mod. 8/20/87)