MKFS(8) — MAINTENANCE COMMANDS
NAME
mkfs − construct a file system
SYNOPSIS
/usr/etc/mkfs [ −N ] [ −G ] [ −M directory-name ] special size [ nsect [ ntrack
[ blksize [ fragsize [ ncpg [ minfree [ rps [ nbpi [ opt [ apc [ rot [ nrpos
[ maxcontig ] ] ] ] ] ] ] ] ] ] ] ] ]
DESCRIPTION
Note: file systems are normally created with the newfs(8) command.
mkfs constructs a file system by writing on the special file special unless the −N flag has been specified. special must be specified as a raw device and disk partition. For example, to create a file system on sd0, specify /dev/rsd0[a-h], where a-h is the disk partition.
The numeric size specifies the number of sectors in the file system. mkfs builds a file system with a root directory and a lost+found directory (see fsck(8)). The number of inodes is calculated as a function of the file system size. No boot program is initialized by mkfs.
When invoked with −G or −M, mkfs expands the file system up to the size specified in the size parameter if size is greater than the existing file system’s size, but less than or equal to the size of the file system’s disk partitions. If invoked with the −M, the file system is expanded while it is mounted on directory-name. All other command line options are ignored except special and size.
If mkfs fails to finish expanding the file system for any reason (e.g., panic, powerfail, etc.), free space may be lost from the file system. The free space can be recovered using fsck(8). No other metadata or userdata inconsistencies are expected unless a hardware exception, such as powerfail, corrupts a write. If fsck is invoked, it is important under these circumstances that the DiskSuite version of fsck be used rather than SunOS 4.1.1 fsck. The 4.1.1 version may report:
BAD SUPER BLOCK: <some condition reported here>
USE -b OPTION TO FSCK TO SPECIFY LOCATION OF AN ALTERNATE
SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck(8).
If the DiskSuite fsck is not available, try running your version of fsck as follows:
fsck -b16 filesystem
Running fsck this way prevents it from checking the super block.
You must be super-user to use this command.
OPTIONS
−N Print out the file system parameters without actually creating the file system.
−G Grow the unmounted file system.
−M directory-name
Grow the file system mounted on directory-name.
The following arguments allow fine tune control over the parameters of the file system.
nsect The number of sectors per track on the disk. The default is 32.
ntrack The number of tracks per cylinder on the disk. The default is 16.
blksize The primary block size for files on the file system. It must be a power of two, currently selected from 4096 or 8192 (the default).
fragsize
The fragment size for files on the file system. The fragsize represents the smallest amount of disk space that will be allocated to a file. It must be a power of two currently selected from the range 512 to 8192. The default is 1024.
ncpg The number of disk cylinders per cylinder group. The default is 16.
minfree
The minimum percentage of free disk space allowed. Once the file system capacity reaches this threshold, only the super-user is allowed to allocate disk blocks. The default value is 10%.
rps The rotational speed of the disk, in revolutions per second. The default is 60.
nbpi The number of bytes for which one inode block is allocated. This parameter is currently set at one inode block for every 2048 bytes.
opt Space or time optimization preference; s specifies optimization for space, t specifies optimization for time. The default is t.
apc The number of alternates per cylinder (SCSI devices only). The default is 0.
rot The expected time (in milliseconds) to service a transfer completion interrupt and initiate a new transfer on the same disk. It is used to decide how much rotational spacing to place between successive blocks in a file. The defazult is 1. Note: in earlier releases mkfs tried to guess what the right value for this parameter by querying the controller type. Since mkfs is a more primitive interface, this query has been moved into newfs. mkfs now does exactly what you tell it to do.
nrpos The number of distinguished rotational positions. The default is 8.
maxcontig
The maximum number of blocks that will be allocated contiguously before inserting a rotational delay. The default is 1. Note: This parameter also controls clustering. Regardless of the value of rotdelay, clustering is enabled only when maxcontig is greater than 1. Clustering allows higher I/O rates for sequential I/O and is described in tunefs(8).
Users with special demands for their file systems are referred to the paper cited below for a discussion of the tradeoffs in using different configurations.
SEE ALSO
dir(5), fs(5), fsck(8), growfs(8), newfs(8), tunefs(8)
Sun Online: DiskSuite Administration Guide
System and Network Administration
McKusick, Joy, Leffler; A Fast File System for UNIX
NOTES
newfs(8) is preferred for most routine uses.
File systems are normally created with the newfs(8) command.
growfs(8) is preferred to grow file systems.
Sun Release 4.1 — Last change: 25 June 1991