newfs, mfs - Constructs a new UFS file system
/usr/sbin/newfs [-N] [newfs-options] special-device [disk-type]
/usr/sbin/mfs [-F mount-flags] [newfs-options] [special-device] mount-node
The newfs command creates a new UFS file system on the specified special-device of type disk-type.
The newfs command cannot be used to create Advanced File System (AdvFS) domains. Instead, use the mkfdmn command, as described in the mkfdmn(8) reference page.
If the disk has been labeled using the disklabel command, newfs builds a UFS file system on the specified device, basing its defaults on the information in the disk label. If the disk has not been labeled using the disklabel command, newfs fails. In this case, use the disklabel command to install a label.
The mfs command builds a memory file system (mfs), which is a UFS file system in virtual memory, and mounts it on the specified mount-node. When the file system is unmounted, mfs exits and the contents of the file system are lost. If mfs is sent a signal while running, for example during system shutdown, it attempts to unmount its corresponding file system. The parameters for mfs are almost the same as those for newfs. For a memory file system, the special-device file provides only a set of configuration parameters, including the size of the virtual memory segment to allocate. If the special-device file is omitted, you must specify the segment size. The special-device file is usually the primary swap area, because that is where the file system is backed up when free memory gets low and the memory supporting the file system has to be paged.
You can enable /tmp as a memory file system by adding
an entry in the /etc/fstab file. For example, the following line
creates a 10 Megabyte memory file system, mounted on /tmp:
-s20480 /tmp mfs rw 1 0
Note that the contents of a memory file system are lost whenever a reboot or unmount is performed.
You must be superuser to use either command.
This section describes the file system dependencies for the UFS file systems.
Displays the file system parameters without creating the file system.
The following newfs-options flags define the general layout policies. The block size of the file system in bytes. Note that the block size is fixed at 8KB. The fragment size of the file system in bytes. The percentage of space reserved from normal users; the minimum free space threshold (minfree). The default value is 10%. See tunefs(8) for more details on how to set this option. The file system can either be instructed to try to minimize the time spent allocating blocks, or to try to minimize the space fragmentation on the disk. If the value of minfree is less than 10%, the default is to optimize for space; if the value of minfree is greater than or equal to 10%, the default is to optimize for time. See tunefs(8) for more details on how to set this option. This specifies the maximum number of contiguous blocks that are laid out before forcing a rotational delay (refer to the -d option); that is, the number of blocks that can be combined into a single read request (cluster). The default value is 8. See tunefs(8) for more details on how to set this option. This specifies the expected time (in milliseconds) to service a transfer completion interrupt and initiate a new transfer on the same disk. The default is zero milliseconds. See tunefs(8) for more details on how to set this option. This indicates the maximum number of blocks any single file can allocate out of a cylinder group before it is forced to begin allocating blocks from another cylinder group. The default is about one-quarter of the total blocks in a cylinder group. See tunefs(8) for more details on how to set this option. This specifies the density of inodes in the file system. The default is to create an inode for each 4096 bytes of data space. If fewer inodes are desired, a larger number should be used; to create more inodes a smaller number should be given. The number of cylinders per cylinder group in a file system. The default value is 16. The size of the file system in sectors.
The following options override the default sizes for the disk geometry. The default values are taken from the disk label. Changing the defaults is useful only if you are using newfs to build (create) a file system whose raw image will eventually be used on a different type of disk (on a write-once disk, for example). Note that changing any of these values from their defaults makes it impossible for fsck to find the alternate superblocks if the standard superblock is lost. The speed of the disk in revolutions per minute. The size of a sector in bytes (almost never anything but 512). The number of sectors per track available for data allocation by the file system. This does not include sectors reserved at the end of each track for bad block replacement (see -p). The number of tracks per cylinder available for data allocation by the file system. Spare sectors (bad sector replacements) are physical sectors that occupy space at the end of each track. They are not counted as part of the sectors per track (-u) since they are not available to the file system for data allocation. Spare sectors (bad sector replacements) are physical sectors that occupy space at the end of the last track in the cylinder. They are deducted from the sectors per track (-u) of the last track of each cylinder since they are not available to the file system for data allocation. Used to describe perturbations in the media format to compensate for a slow controller. Interleave is physical sector interleave on each track, specified as the denominator of the ratio: sectors read/sectors passed over.
When using newfs to create a UFS file system on an LSM volume, follow these guidelines: The disk-type variable may be specified to enable newfs to obtain disk attributes such as number of sectors (ns), number of tracks (nt), and number of cylinders (nc) from the /etc/disktab file. The newfs command may get this information from /etc/disktab because an LSM volume has no disk label. When specifying disk-type, you can use any entry in /etc/disktab that has positive values for the disk attributes (except rx## entries). Since the entries for disks with dynamic geometry (such as RAID, re, SWXCR, and hsz##) have a value of -1 for these attributes, such disk types cannot be specified to newfs. Instead, use another entry whose characteristics match those of the volume (for example, rz##). Or, you can create a customized entry in /etc/disktab. The -s option can be omitted, because newfs queries LSM for the size of the LSM volume. If the -s option is specified, it overrides the LSM query.
You may receive the following messages when using the newfs command: newfs: /dev/rvol/diskgroup/volname: only 0 partitions
The following examples illustrate some of these messages: Creating a file system on a partition that is marked for use: # /usr/sbin/newfs /dev/rrz11g
/dev/rrz11g is marked in use for LSMpubl in the disklabel. If you continue with the operation you can possibly destroy existing data. CONTINUE? [y/n]
Partition(s) which overlap /dev/rrz11c are marked in use. If you continue with the operation you can possibly destroy existing data. CONTINUE? [y/n]
/dev/rrz11g or an overlapping partition is open. Quitting... Creating a file system on disk that does not have a disk label: # /usr/sbin/newfs /dev/rrz11c
The disklabel for /dev/rrz11c does not exist or is corrupted. Quitting...
Specifies the command path. Specifies the command path. Provides disk geometry and file system partition information.
Commands: chmod(1), disklabel(8), fsck(8), mkfdmn(8), mount(8), tunefs(8)
Files: disktab(4), fstab(4)
Functions: check_usage(3), set_usage(3) delim off