The ufs-specific module of mkfs builds a ufs file system with a root directory and a lost+found directory (see fsck(1M))
The ufs-specific mkfs is rarely run directly; use the newfs(1M) command instead.
raw_device_file indicates the disk partition to write on unless the -o N option has been specified, or either the -V or -m generic options are passed from the generic mkfs module. size specifies the number of sectors in the file system. This argument must follow the raw_device_file argument and is required (even with -o N), unless the -V or -m generic options are specified.
generic_options are supported by the generic mkfs command. See mkfs(1M) for a description of these options.
The following options are supported:
The number of alternate sectors per cylinder to reserve for bad block replacement (SCSI devices only). The default is 0.
Logical block size, either 4096 or 8192. The default is 8192. The sun4u architecture does not support the 4096 block size.
The number of cylinders per cylinder group (ranging from 16 to 256). The default is calculated by dividing the number of sectors in the file system by the number of sectors in a gigabyte, and then multiplying the result by 32. The default value will always be between 16 and 256. The per-cylinder-group meta data must fit in a space no larger than that available in one logical file system block. If too large a cgsize is requested, it is decreased by the minimum amount necessary.
The smallest amount of disk space in bytes to allocate to a file. The smallest amout of disk space in bytes to allocate to a file. If the logical block size is 4096, legal values are 512, 1024, 2048, and 4096. When the logical block size is 8192, legal values are 1024, 2048, 4096, and 8192. The default value is 1024.
The minimum percentage of free space to maintain in the file system. This space is off-limits to normal users. Once the file system is filled to this threshold, only the superuser can continue writing to the file system. This parameter can be subsequently changed using the tunefs(1M) command. The default is 10%.
Rotational delay. The expected time (in milliseconds) to service a transfer completion interrupt and initiate a new transfer on the same disk. The value is used to decide how much rotational spacing to place between successive blocks in a file. This parameter can be subsequently changed using the tunefs(1M) command. The default is disk-type dependent.
The maximum number of logical blocks, belonging to one file, that will be allocated contiguously before inserting a rotational delay. For a 4K file system, the default is 14; for an 8K file system it is 7. This parameter can be subsequently changed using the tunefs(1M) command. Where maxphys is the maximum size of physical I/O requests supported by UFS (1048576 bytes), the value for maxcontig must obey the relationship:
maxphys >= maxcontig * logical bsize
This parameter also controls clustering. Regardless of the value of gap, 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(1M).
Set the parameters of the file system to allow eventual growth to over a terabyte in total file system size. This option sets fragsize to be the same as bsize, and sets nbpi to 1 megabyte, unless the -i option is used to make it even larger. If you use the -f or -i options to specify a fragsize or nbpi that is incompatible with this option, the value of fragsize or nbpi is ignored.
Logging is enabled by default on all file systems created with this option.
Print out the file system parameters without actually creating the file system.
The number of bytes per inode, which specifies the density of inodes in the file system. The number is divided into the total size of the file system to determine the fixed number of inodes to create. It should reflect the expected average size of files in the file system. If fewer inodes are desired, a larger number should be used; to create more inodes, a smaller number should be given. The default is 2048.
The number of different rotational positions in which to divide a cylinder group. The default is 8.
The number of sectors per track on the disk. The default is 32.
The number of tracks per cylinder on the disk. The default is 16.
Space or time optimization preference; s specifies optimization for space, t specifies optimization for time. The default is t. This parameter may be subsequently changed with the tunefs(1M) command.
The rotational speed of the disk, in revolutions per second. The default is 60.
Alternatively, parameters can be entered as a list of space-separated values (without keywords) whose meaning is positional. In this case, the -o option is omitted and the list follows the size operand. This is the way newfs passes the parameters to mkfs.
See attributes(5) for descriptions of the following attributes:
The following error message occurs typically on very high density disks. On such disks, the file system structure cannot encode the proper disk layout information, resulting in suboptimal performance.
Warning: insufficient space in super block for rotational layout tables with nsect sblock.fs_nsect and ntrak sblock.fs_ntrak. (File system performance may be impaired.)
The following error message occurs if a user request for inodes or bytes (with the nbpi keyword) and the disk geometry results in a situation in which the last truncated cylinder group cannot contain the correct number of data blocks; some disk space is wasted.
Warning: inode blocks/cyl group (grp) >= data blocks (num) in last cylinder
The following error message occurs if the user parameters and disk geometry conflict; some disk space is lost. A possible cause is the specified size being smaller than the partition size.
Warning: num sector(s) in last cylinder group unallocated
You can use lofiadm to create a file that appears to a mkfs command (for example, mkfs_pcfs or mkfs_ufs) as a raw device. You can then use a mkfs command to create a file system on that device. See lofiadm(1M) for examples of creating a UFS and a PC (FAT) file system on a device created by lofiadm.