mkfs
PURPOSE
Makes a file system.
SYNOPSIS
mkfs device [ [ -f filesystem ] [ -s cyl:skip ] [ -v volume ] ]
[ -p program ] [ -b blocknum ]
[ [ blocks ] [ blocks:inodes ] [ prototype ] ]
DESCRIPTION
The mkfs command makes new file systems. mkfs initial-
izes the volume label and file system label, start-up
block, bad-block list, and interleaves the free list in
accordance with the flags or with defaults found in the
/etc/filesystems file.
The mkfs command creates the new file system on the
device specified on the command line. device can be a
block device name, raw device name, or file system name.
If it is a file system name, mkfs uses this name as the
filesystem and uses the following parameters from the
applicable stanza in /etc/filesystems:
dev Device name.
cyl See the following -s flag.
skip See the following -s flag.
vol Volume ID.
bad List of bad blocks separated by commas.
size File system size.
boot Program to be installed in start up block.
FILE SYSTEM SIZE
You can specify the size of a new file system in the fol-
lowing way:
o On the command line
o In the prototype file
o In the /etc/filesystems entry for the given file
system
If the size is not specified in any of these places, mkfs
takes it from the devinfo structure for the block device
associated with the file system being generated. (See
the ioctl system call and the devinfo file in AIX Oper-
ating System Technical Reference.) The size provided in
the devinfo structure is the maximum size of the file
system in any case. A size specification on the command
line overrides any defaults found in the devinfo struc-
ture or in /etc/filesystems.
PROTOTYPE FILES
To initialize the contents of a new file system in
accordance with a prototype, specify the name of a proto-
type file on the command line. The proto command can be
used to construct prototype files from existing file
systems.
The prototype file contains tokens separated by spaces or
new-line characters. The first token is the name of a
file to be copied onto block 0 as the bootstrap program.
The second token is a number specifying the size of the
created file system. Typically it is the number of
blocks on the device, perhaps diminished by space for
paging. The next token is the number of i-nodes in the
i-list. (mkfs rounds this to fill out the appropriate
number of blocks.) The next set of tokens contains the
specifications for the root file. File specifications
consist of tokens giving the mode, the user name, the
group name, 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 six-character string. The
first character specifies the type of the file. (The
characters -, b, c, and d specify regular, block special,
character special, and directory files, respectively.)
The second character must be either u or -. If u is
used, the set-user-ID mode is specified; if - is used the
set-user-ID mode is not specified. The third character
must be either g or - for specifying 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").
Two decimal number tokens come after the mode. They
specify the user and group names of the owner of the
file.
If the file is a regular file, the next token is a path
name from which the contents and size are copied.
If the file is a block or character special file, two
decimal number tokens follow, which give the major and
minor device numbers.
If the file is a directory, mkfs makes the entries .
(dot) and .. (dot dot) and then recursively reads a list
of names and file specifications for the entries in the
directory. The scan is ended with the token $ (dollar
sign).
FLAGS
-bblocknum When present, specifies the number of
blocks allocated to file i-node1 which
is automatically created.
-ffilesystem Specifies the file system label for the
new file system. This can be up to six
characters.
-pprogram Specifies the name of a program to be
installed in block 0 of the new file
system. The default bootstrap program
is /stand/boot.
-scyl:skip Specifies an interleaving of the free
list. (Interleaving the free list can
improve the speed of disk I/O.) cyl is
the number of blocks per cylinder, and
skip is the number of blocks to skip.
-vvolume Specifies the volume label for the new
file system. This can be up to six
characters.
blocks[:inodes] A size specification where blocks is
the number of 512-byte blocks in the
file system. When inodes is specified,
it determines the number of i-nodes on
the system. If inodes is not speci-
fied, a number suitable for the size of
the file system is used. The number of
i-nodes is rounded up so that the
i-node area occupies an integral number
of blocks.
EXAMPLES
1. To create an empty file system on a diskette:
mkfs /dev/fd0
2. To specify volume and file system names for a new
file system:
mkfs /dev/fd0 -fWORKFS -vVOL001
This creates an empty file system on the diskette,
giving it the volume serial "VOL001" and file system
name "WORKFS".
RELATED INFORMATION
The following command: "fsck, dfsck."
The ioctl system call and the devinfo, dir, filesystems,
and fs files in AIX Operating System Technical Reference.