mkfs(ADM)


mkfs -- construct a filesystem

Syntax

/etc/mkfs [-f fstype] [-F fstype] [-mnpVy] [-o options] device
[gap blks_per_cyl] blocks[:inodes] [-E] [-Cclustersize]

/etc/mkfs [-f fstype] [-mnpVy] device proto [gap blks_per_cyl] [-Cclustersize]

Description

mkfs constructs a filesystem on a special device. mkfs invokes the appropriate mkfs executable in the directory /etc/fscmd.d/fstyp according to the type of filesystem (fstyp) to be made.

The fstyp argument to the -f and -F options specify one of the following filesystem types:


AFS
Acer Fast Filesystem

EAFS
Extended Acer Fast Filesystem

HTFS
High Throughput Filesystem

S51KB
AT&T UNIX® System V 1KB Filesystem

VXFS
VERITAS Filesystem

Standard options

mkfs checks whether there is any data in the first 1024 bytes of the target device. If there is any variation, the disk is assumed to contain a filesystem, and operator confirmation is requested before overwriting the data. The -y option (yes) overrides this, and writes over any existing data without question. The -n option (no) causes mkfs to terminate without question if the target contains an existing filesystem. The -p option prints the percentage complete value on the screen.

device is the raw special device on which to make the filesystem.

blocks specifies the size of the filesystem as the decimal number of physical (512-byte) disk blocks the filesystem will occupy. If the number of inodes is not given, the default used is approximately the number of logical (1024-byte) blocks divided by 4. mkfs builds a filesystem containing a single empty directory. The boot program block (block zero) is left uninitialized. When creating a filesystem, the blocks specification is optional.

If the specified size (in blocks) exceeds the capacity of the device, mkfs will fail, unless the -y option is used. The -y option forces mkfs to ignore the results of any matching.

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.

The following is an example of a prototype specification (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 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 and blks_per_cyl arguments specify the rotational gap and the number of blocks per cylinder.

gap must be greater than zero and less than or equal to the number of blk_per_cyl; otherwise the default value of 1 is used. If the default value is used, the value of blk_per_cyl has no effect on the filesystem layout.

blk_per_cyl must be greater than zero and less than 1500; otherwise the default of 400 blocks per cylinder is used.

AFS filesystem options

The -C clustersize option specifies the cluster size for the filesystem. The -C option must be the last option on the command line. The clustersize argument must be a power of two and can take one of these values: 1, 2, 4, 8, or 16. 16 is the default cluster size. (A cluster is a fixed number of logically contiguous disk blocks that are allocated to a file by the AFS or EAFS. A bitmap representing block allocation on the disk is searched for a cluster in which at least one block is free for use. As many of the free blocks from the cluster that are needed by the file are allocated to it. If the file needs more blocks, or if the file grows in size, then the search for a new cluster begins at the last block assigned to a file. In this way, a file's blocks should be logically sequential and relatively close to each other.)

If the -C option is specified, the filesystem created will be AFS unless the type is specified using -f or -E.

EAFS filesystem options

The -E option specifies that an EAFS filesystem is to be made. The -C clustersize option specifies the cluster size as described for AFS filesystems. The -E option must precede the -C option, and the -C option must be the last on the command line.

HTFS filesystem options

The -C clustersize option specifies the cluster size as described for AFS filesystems.

VXFS filesystem options

In order to provide SCO OpenServer Release 5 syntax for existing SCO OpenServer users, the -C option is translated into block size (-obsize=NNNN). For VxFS filesystems, mkfs defaults to ``largefiles''. Unless overriden with an explicit -obsize=NNNN or -C NN, block size is chosen by a sliding formula that increases with filesystem size.

Authorization

Permission to use this utility requires the backup authorization in authorize(F). Refer to subsystem(M) for details.

Examples

Create an HTFS(TM) filesystem with a cluster size of 8 and 1000 inodes on the first 1.44MB floppy disk drive:

/etc/mkfs -f HTFS /dev/rfd0135ds18 2880:1000 -C 8

Limitations

With a prototype file, the maximum size of a file that can be copied in is dependent on the type of filesystem being created.

Files


/etc/vtoc/*

/etc/fscmd.d/fstyp
directory containing programs for each filesystem type; mkfs invokes the appropriate binary

See also

chmod(C), dir(FP), divvy(ADM), fdisk(ADM), filesystem(FP), mkfs_vxfs(ADM) mount(ADM)

Standards conformance

mkfs is conformant with AT&T SVID Issue 2.

Notices

A version of mkfs that can handle files greater than 2GB is available in /u95/bin. See mkfs(1M) for more information.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005