MKFS(8,C) AIX Commands Reference MKFS(8,C)
-------------------------------------------------------------------------------
mkfs
PURPOSE
Makes a file system.
SYNTAX
+-------------------+ +- -p/stand/boot -+
mkfs --- device ---| +---------------+ |---| |--->
+-| -ffilesystem |-+ +--- -pprogram ---+
^| -scyl:skip ||
|| -vvolume ||
|| -l ||
|| -r ||
|| -ggfs ||
|| -Pgfspack ||
|+---------------+|
+-----------------+
+-------------------+
>---| one of |---|
| +---------------+ |
+-| blocks |-+
| blocks:inodes |
| prototype |
+---------------+
DESCRIPTION
The mkfs command makes new file systems. This command initializes the volume
label and file system label, the startup block, and the bad-block list. It
also 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. The device can be a block device name, raw device name, or file
system name. If device is a file system name, mkfs uses this name as the
filesystem and uses the following parameters from the applicable stanza in the
file /etc/filesystems:
dev Device name.
cyl See the -s flag on page 4.
skip See the -s flag on page 4.
vol Volume ID.
bad List of bad blocks separated by commas.
size File system size.
Processed November 8, 1990 MKFS(8,C) 1
MKFS(8,C) AIX Commands Reference MKFS(8,C)
boot Program to be installed in the startup block.
gfs Global file system number to be assigned to this file system.
gfspack Global file system pack number to be assigned to this file system if it
is to be replicated (used with -r option).
FILE SYSTEM SIZE
You can specify the size of a new file system in the following ways:
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 Operating
System Technical Reference.) The size provided in the devinfo structure is the
maximum size of the file system in any case. If you specify a file system size
larger than that returned in the devinfo structure, the devinfo value is used
instead. Assuming you do not specify a size larger than the size provided in
devinfo, a size specification on the command line overrides any defaults found
in devinfo or in the file /etc/filesystems.
GLOBAL FILE SYSTEM NUMBERS
Each file system must be given a global file system number (gfs) to distinguish
it from other file systems mounted on that machine, or, if the Transparent
Computing Facility is installed, to distinguish it from other file systems
mounted in the same cluster. If its value is not 0, the global file system
number can be in the range of 1 to a system-configurable value, which defaults
to 300. A gfs value of 0 can be used to indicate that the system should assign
a gfs number each time it is mounted. This is intended primarily for use for
file systems created on a removable medium and may not be used for replicated
file systems.
You can specify the gfs number of a new file system in the following ways:
o On the command line with the -ggfs option.
o In the gfs entry for this file system in the /etc/filesystems file.
If the gfs value not specified in one of these ways, mkfs prompts the user for
it.
In addition to the global file system number, if the file system is created to
be a replicated file system with the -r option, a global file system pack
number (gfspack) number must be specified. The global file system pack number
can be in the range of 1 to 32. Each copy of a replicated file system must
have a unique number. The global file system pack number can be specified on
the command line (-Pgfspack option) or in the /etc/filesystems file (gfspack
entry). If it is not specified in one of these places, mkfs prompts the user
for it.
Processed November 8, 1990 MKFS(8,C) 2
MKFS(8,C) AIX Commands Reference MKFS(8,C)
PROTOTYPE FILES
To initialize the contents of a new file system in accordance with a prototype,
specify the name of a prototype 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 inodes
in the i-list. (The mkfs command 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, s, and d specify
regular, block special, character special, symbolic link, 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, giving the
major and minor device numbers. If the file is a symbolic link, the next token
is the path name that is to be used as the contents of the symbolic link.
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).
The mkfs command can also be run noninteractively, taking its directions from a
"here" document or an input file (rather than the command line). When mkfs is
run noninteractively, it assumes "yes" answers to the following questions for
which it would normally prompt you:
mkfs: destroy DEVICE (y)?
inode count OK:(y/n)
A "yes" answer to the first question means that mkfs automatically overwrites
any pre-existing file system with the name specified on the command line. A
"yes" answer to the inode-count question means mkfs has calculated an inode
count and assumes it is correct.
Processed November 8, 1990 MKFS(8,C) 3
MKFS(8,C) AIX Commands Reference MKFS(8,C)
FLAGS
-ffilesystem Specifies the file system label for the new file system.
The label can be up to 32 characters. If you have selected
a language (through the LANG environment variable) that
supports multibyte characters, the 32-character limit may be
reduced by as much as 50%, depending on the character code
set being used.
-ggfs The global file system number to be assigned to this file
system. The overriding value, if any, is found in the file
/etc/filesystems.
-l Creates a lost+found directory for the file system. The
allows the fsck command to take corrective actions when
certain types of file system inconsistency problems are
discovered.
-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.
-Pgfspack The global file system pack number to be assigned to this
file system (meaningful only if the file system is
replicated). The overriding value, if any, is found in the
file /etc/filesystems.
-r Creates a replicated file system.
-scyl:skip Specifies an interleaving of the free list. (Interleaving
the free list can improve the speed of disk I/O.) The cyl
argument 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. The
volume argument can be up to 8 characters.
blocks[:inodes] A size specification where blocks is the number of 1024-byte
blocks in the file system. When inodes is specified, it
determines the number of inodes on the system. If inodes is
not specified, a number suitable for the size of the file
system is used. The number of inodes is rounded up so that
the inode area occupies an integral number of blocks.
EXAMPLES
(Note: The following two examples do not apply to AIX/370.)
1. To create an empty file system on a diskette:
mkfs /dev/fd0
Processed November 8, 1990 MKFS(8,C) 4
MKFS(8,C) AIX Commands Reference MKFS(8,C)
2. To specify volume and file system names for a new filesystem:
mkfs /dev/fd0 -fWORKFS -vVOL001
This command creates an empty file system on the diskette, giving it the
volume serial "VOL001" and file system name "WORKFS".
RELATED INFORMATION
See "fsck, dfsck."
See the ioctl system call and the devinfo, dir, filesystems, and fs files in
AIX Operating System Technical Reference.
Processed November 8, 1990 MKFS(8,C) 5