mkfs(1M)
NAME
mkfs − construct a file system
SYNOPSIS
/etc/mkfs [−L | −S] special size [nsect ntrack blksize fragsize ncpg minfree rps nbpi]
/etc/mkfs [−L | −S] special proto [nsect ntrack blksize fragsize ncpg minfree rps nbpi]
REMARKS
HFS file systems are normally created with the newfs(1M) command.
DESCRIPTION
mkfs constructs a file system by writing on the special file special. mkfs builds a file system with a root directory and a lost+found directory (see fsck(1M)). The FS_CLEAN magic number for the file system is stored in the super block.
Options
mkfs recognizes the following options:
−L Build a file system that allows directory entries (file names) to be up to MAXNAMLEN (255) bytes long.
−S Build a file system that allows directory entries (file names) to be up to DIRSIZ (14) bytes long.
There are two types of HFS file systems; they are distinguished mainly by differing directory formats that place these different limits on the length of file names. If neither option is specified, mkfs creates a file system of the same type as the root file system.
Arguments
One of the following arguments is required after special:
size Specifies the number of DEV_BSIZE blocks in the file system ( DEV_BSIZE is defined in <sys/param.h>.)
proto If proto is a file name that can be opened, mkfs assumes it to be a prototype file and takes its directions from that file. Prototype structure is described in detail below.
The following optional arguments allow fine-tune control over file system parameters:
nsect Number of sectors per track on the disk.
ntrack Number of tracks per cylinder on the disk.
blksize Primary block size for files on the file system. Must be a power of two. See DEPENDENCIES for legal values.
fragsize Fragment size for files on the file system. fragsize represents the smallest amount of disk space to be allocated to a file. It must be a power of two not smaller than DEV_BSIZE and no smaller than one-eighth of the file system block size.
ncpg Number of disk cylinders per cylinder group. This number must be in the range 1 to 32.
minfree Minimum percentage of free disk space allowed. Once the file system capacity reaches this threshold, only Only users with appropriate privileges can allocate disk blocks. The default value is 10%. If a disk does not revolve at 60 revolutions per second, the rps parameter can be specified.
nbpi Number of data bytes (amount of user file space) per inode slot. The number of inodes is calculated as a function of the file system size. If nbpi is not valid, its value defaults to 2048.
The -L or -S option specifies that mkfs should build a file system that allows directory entries (file names) to be up to MAXNAMLEN (255) or DIRSIZ (14) bytes long, respectively. There are two types of HFS file systems; they are distinguished mainly by differing directory formats that place these different limits on the length of file names. If neither option is specified, mkfs creates a file system of the same type as the root file system.
If the second argument is a file name that can be opened, mkfs assumes it to be a prototype file proto, and takes its directions from that file. The prototype file contains tokens separated by spaces or new-line characters.
Prototype File Structure
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 zero as the bootstrap program (usually /etc/BOOT). If the name of a file is "", it is ignored. The second token is a number specifying the number of DEV_BSIZE- byte blocks in the file system. The next tokens comprise the specification for the root directory. File specifications consist of tokens giving the mode, user-id, group id, and 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 −bcdlL specify regular files, block special files, character special files, directories, symbolic links, and hard links 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 tokens come after the mode; they specify the user and group IDs of the owner of the file. These values can be specified numerically or by using symbolic names that appear in the password and group databases.
If the file is a regular file, the next token is a pathname from which the contents and size are copied.
If the file is a block or character special file, two numeric tokens follow which give the major and minor device numbers.
If the file is a directory, mkfs makes the entries . and .., then reads a list of names and (recursively) file specifications for the entries in the directory. The scan is terminated with the token $.
If the file is a symbolic link, the next token is a pathname that is used as the path to which the symbolic link should point.
If the file is a hard link, the next token is a pathname that is used as the name of the file within the new filesystem to which this entry should be linked. The mode, owner and group fields of this entry are ignored; they are taken from the target of the link. The target of the link must be listed before the entry specifying the link. Hard links to directories are not permitted.
With the exception of the mode field (which is always an octal number), all numeric fields may be specified in hex, octal or decimal using standard notation (values starting with a leading 0x are hex, with a leading 0 are octal; all others are decimal).
Here is a sample prototype specification:
/etc/BOOT
4872
d−−555 bin bin
bin d−−555 bin bin
sh −−−555 bin bin /bin/sh
rsh L−−555 bin bin /bin/sh
su −u−555 root bin /bin/su
$
dev d−−555 bin bin
b0 b−−640 root sys 0 0x0e0000
c0 c−−640 root sys 4 0x0e0000
$
etc d−−555 bin bin
init −−−555 bin bin /etc/init
passwd −−−444 bin bin /etc/passwd
yp l−−444 bin bin /usr/etc/yp
$
usr d−−555 bin bin
bin d−−555 bin bin
more −−−555 bin bin /usr/bin/more
$
$
$
Access Control Lists (ACLs)
Every file with one or more optional ACL entries consumes an extra (continuation) inode. If you anticipate significant use of ACL s on a new file system, you can allocate more inodes by reducing the value of nbpi appropriately. The small default value typically causes allocation of many more inodes than are actually necessary, even with ACL s. To evaluate your need for extra inodes, run bdf −i on existing file systems. For more information on access control lists, see acl(5).
WARNINGS
There is no way to specify links in the proto file.
DEPENDENCIES
Series 300/400/800:
Valid file system block sizes are 4096 and 8192.
Series 700:
Valid file system block sizes are 4096, 8192, 16384, 32768, and 65536.
AUTHOR
mkfs was developed by HP and the University of California, Berkeley.
SEE ALSO
chmod(1), bdf(1M), fsck(1M), fsclean(1M), newfs(1M). dir(4), fs(4), group(4), passwd(4), symlink(4), acl(5).
Hewlett-Packard Company — HP-UX Release 8.05: June 1991