mkfs(1M) mkfs(1M)NAME mkfs - constructs a System V file system SYNOPSIS mkfs device-file blocks[:inodes] [gap modulus] mkfs device-file proto-file [gap modulus] ARGUMENTS blocks Specifies the number of physical blocks the file system will occupy. device-file Specifies the partition (logical disk) on which the file system will be placed. gap Specifies the value for the rotational gap. The value of gap allows certain disk blocks to be treated as logically contiguous even though they are not physically contiguous. Specifically, blocks that are gap blocks apart are treated as if they are contiguous during read and write operations. In this way, the delay between two consecutive reads or writes of blocks can be accounted for so that the disk medium does not rotate beyond the location of the next ``logically ordered'' block. The default value is 1, which disables this remapping function. The default values for gap and modulus are also used when the values you specify for these arguments are considered illegal values. inodes Specifies the number of inode slots for the new file system. modulus Specifies the value for the modulus. The value of modulus is needed to help determine what blocks are treated as logically contiguous (See the description of gap earlier in the manual page.) With each complete revolution, you may need to introduce some extra offset besides the fixed value gap. For example, for a gap value of 2 and a hypothetical 10 blocks per revolution, physical blocks 0, 2, 4, 6, and 8 would be treated as contiguous. However, if this scheme were continued throughout the disk, odd-numbered physical blocks would never become accessible. A modulus value of 10 corrects the mapping so that after physical block 8 is mapped, block 1 is mapped, followed by 3, 5, 7, and 9. January 1992 1
mkfs(1M) mkfs(1M)The default value is 1. The default values for gap and modulus are also used if the values you specify for these arguments are considered illegal. proto-file Specifies the name of a prototype file that contains precise instructions for the construction of the file system. See ``proto File Format'' in the ``Description'' section for more detailed information about the instructions that can be placed in a proto file. DESCRIPTION mkfs constructs a System V file system by writing in the partition (logical disk) associated with device-file according to the directions found in the remainder of the command line. The command waits 10 seconds before starting to construct the file system. If the second argument is given as a string of digits (blocks), mkfs builds a file system with a single empty directory on it. The size of the file system corresponds to the value of blocks interpreted as a decimal number. The content of block 0 of the new file system is left uninitialized. If inodes is omitted, the default is the value that results when blocks is divided by 4. If the second argument is the name of a file that can be opened (proto-file), mkfs treats it as a proto-file file containing specifications that control the creation of a new file system. The overall format of the proto-file file is as follows. (Brackets indicate optional items.) program blocks inodes file-system-mode user-id group-id [ directory directory-mode user-id group-id [ file file-mode user-id group-id initial-contents ] . . . $] . . . In the first line of the proto-file, replace program with the name of a file to be copied onto block 0 of the new file system. This collection of bytes is sometimes called the bootstrap program. 2 January 1992
mkfs(1M) mkfs(1M)In the second line of the proto-file, replace blocks with the size of the new file system in disk (512-byte) blocks. Typically, the size is the number of blocks within a partition created with Apple HD SC Setup. Refer to the disk-management section of A/UX Local System Administration for details about the use of Apple HD SC Setup with A/UX. The inodes argument appears after blocks in the second line. Replace inodes with the number of inode slots for the new file system. Each inode slot can contain the operating- system data that describes one file. The maximum number of configurable inode slots is 65,500, but the actual number depends on the number of blocks available to the new file system. Eight inode slots fill one disk block (512 bytes). The third line of the proto-file contains file-system-mode. The first three characters of file-system-mode are d--. The last three characters of file-system-mode are the permission digits for the owner, group, and all other users that the mount point acquires whenever the new file system is mounted on it. See mount(1M) and chmod(1) for details. The user-id argument appears after file-system-mode in the third line. Replace user-id with the numeric user ID of the user account that you want to own the file. The group-id argument appears after user-id. Replace group-id with the numeric group ID of the group account that you want to associate with the file. The optional fourth line of the proto-file is the beginning of a directory specification. A directory specification is unusual because it requires more than one line to be complete. At least two lines are required, and the last line must contain the end-of-directory delimiter $. Between the starting and ending lines of a directory specification, you can place any number of file specifications or additional (nested) directory specifications. The number of lines in a directory specification depends on the number of files and nested directories with which the file system is to be initialized. The directory argument appears on the first line of a directory specification. Replace directory with a legal System V file-system filename (containing up to 14 characters). The directory-mode argument appears after directory. Treat the replacement value of directory-mode the same way that you treat file-system-mode. The user-id and group-id arguments, which have already been described, appear after directory-mode. The remaining lines of the directory specification comprise any number of file specifications, any number of embedded January 1992 3
mkfs(1M) mkfs(1M)directory specifications, and a line containing the end-of- directory delimiter ($). A file specification is one line in length and begins with a value for file, which should be a legal System V file-system filename. The file-mode argument appears after file. Replace file-mode with a 6-character string, where the first character specifies the file type: - Specifies a regular file. b Specifies a block device file. c Specifies a character device file. See mknod(1M) for explanations of block and character device files. The second character of file-mode specifies whether the user-ID permission is set or not: u Sets the user-ID mode. - Does not set the user-ID mode. The third character of file-mode indicates whether the group-ID permission is set or not: g Sets the group-ID mode. - Does not set the group-ID mode. The last three characters of file-mode specify the octal number corresponding to the desired octal permission digits for the owner, group, and all other users. See chmod(2). The user-id and group-id arguments appear after file-mode; user-id and group-id are described earlier in this section. The initial-contents argument appears after group-id. Replace initial-contents with the pathname of the file to be used as the source of data that is copied into file. If the file-specification line should represent a device file, the file-specification follows a slightly different format: file-name file-mode user-id group-id major-no minor-no As you can see, initial-contents is replaced with major and 4 January 1992
mkfs(1M) mkfs(1M)minor device numbers. See intro(7) for more information about device files and about major and minor device numbers. Before giving any file specification, give an enclosing directory specification. The format of a directory entry is similar to that of a file-specification line but lacks initial-contents information. For each directory specification, mkfs makes the directory entries . and .. before continuing. Once these directory provisions are made, mkfs can build the files for any file-specification lines that might follow-up to the end-of-directory delimiter. Because nested directory specifications are permitted, mkfs recursively builds those nested files and directories. Here is a sample proto-file file specification: /stand/diskboot 4872 110 d--777 3 1 usr d--777 3 1 sh ---755 3 1 /bin/sh john d--755 6 1 $ b0 b--644 3 1 0 0 c0 c--644 3 1 0 0 $ $ The following directory listing illustrates the contents of the file system that is built from the specification just given: % ls -ld usr drwxr-xr-x 3 sys daemon 96 Aug 7 14:43 usr % ls -lR usr total 93 brw-r--r-- 1 sys daemon 0, 0 Aug 7 14:43 b0 crw-r--r-- 1 sys daemon 0, 0 Aug 7 14:43 c0 drwxr-xr-x 2 6 daemon 32 Aug 7 14:42 john -rwxr-xr-x 1 sys daemon 46172 Aug 7 14:42 sh usr/john: total 0 The files displayed for the usr directory are listed in reverse order to the order of creation because the ls command sorts each line alphabetically according to filename. January 1992 5
mkfs(1M) mkfs(1M)EXAMPLES To make an 800K file system on a 3.5-inch floppy disk, use this command: mkfs /dev/rfloppy0 1600 This command makes a file system on the floppy medium referenced through /dev/rfloppy0. The new file system extends for 1600 512-byte disk blocks (800K). LIMITATIONS When a proto-file file is used, mkfs can create a file system larger than the physical medium. If a proto-file file is used, you cannot initialize a file larger than 64K, nor can you specify links. Modern hard disks independently perform the same optimizations that modulus and gap are supposed to enable. For the vast majority of disks, therefore, the A/UX operating system need not be encumbered with the function of disk-block remapping. It is worthwhile to consider entering values that would trigger block remapping only for certain rare and old-fashioned disks. Even when some optimization is feasible, the optimization cannot be achieved unless you can determine from technical specifications for the disk what values are needed for the gap and modulus. FILES /etc/fs/svfs/mkfs Executable file SEE ALSO fsirand(1M), mknod(1M), moant(1M), newfs(1M) chmod(2), dir(4), fs(4), intro(7) in A/UX Programmer's Reference 6 January 1992