mkfs(ADM) 19 June 1992 mkfs(ADM) Name mkfs - construct a filesystem Syntax /etc/mkfs [ -y | -n ] [ -f fstype ] filsys blocks [ : inodes ] [ gap blocks/cylinder ] [ filesystem-specific options ] /etc/mkfs [ -y | -n ] filsys proto [ gap blocks/cylinder ] [ filesystem-specific options ] XENIX filesystem options: [-s blocks [ : inodes ] ] AFS filesystem options: [ -C clustersize ] EAFS filesystem options: [ -C clustersize ] Description mkfs constructs a filesystem by writing on the special file filsys, according to the directions found in the remainder of the command line. mkfs is actually a front-end that invokes the appropriate version of mkfs according to the filesystem type. The -f option specifies the filesystem type, which can be one of the following: AFS (Acer Fast Filesystem) EAFS (Extended Acer Fast Filesystem) S51K (UNIX) XENIX DOS Standard options If it appears that the special file contains a filesystem, operator con- firmation is requested before overwriting the data. The -y ``yes'' option overides this, and writes over any existing data without question. The -n option causes mkfs to terminate without question if the target contains an existing filesystem. The check used is to read block one from the target device (block one is the super-block) and see whether the bytes are the same. If they are not, this is taken to be meaningful data and confirmation is requested. If the second argument to mkfs is a string of digits, the size of the filesystem is the value of blocks interpreted as a decimal number. This is the number of physical (512-byte) disk blocks the filesystem will occupy. If the number of inodes is not given, the default is approxi- mately the number of logical blocks divided by 4. mkfs builds a file- system with a single empty directory on it. The boot program block (block zero) is left uninitialized. If the second argument is the name of a file 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 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 $ 11 $ 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 filesystem is to occupy and the number of inodes in the filesystem. Lines 3-9 tell mkfs about files and directories to be included in this filesystem. Line 3 specifies the root directory. Lines 4-6 and 8-9 specify other directories and files. The ``$'' on line 7 tells mkfs to end the branch of the filesystem it is on, and continue from the next higher directory. The ``$'' on lines 10 and 11 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 -bcd to specify regular, block special, character special and directory files, 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, and other read, write, execute permissions (see chmod(C)). 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 pathname from which 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 directory, mkfs makes the entries ``.'' 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 ``$''. The gap blocks/cylinder argument in both forms of the command specifies the rotational gap and the number of blocks/cylinder. This number must be greater than zero and less than 1500, or else the default of 400 blocks/cylinder is used. XENIX filesystem options The -s option is a command-line override of the size and number of inodes in the proto file. AFS filesystem options The -C clustersize option specifies the cluster size for the filesystem. This only applies to AFS (or EAFS); if it is included on the command line, the filesystem created will be AFS regardless of the other options used (unless EAFS is specified). The -C option must be the last option on the command line. EAFS filesystem options The -C clustersize option specifies the cluster size for the filesystem. This only applies to EAFS or AFS filesystems. The -C option must be the last option on the command line. File /etc/vtoc/* See also chmod(C), dir(FP), filesystem(FP) Notes With a prototype file, the maximum size of a file that can be copied in is dependent on the type of filesystem being created. The directory /etc/fscmd.d/type contains programs for each filesystem type; mkfs invokes the appropriate binary.