newfs(8) — Maintenance
NAME
newfs, mfs − Constructs a new file system
SYNOPSIS
/usr/sbin/newfs [-N] [newfs-options] special-device [disk-type]
/usr/sbin/mfs [-F mount-flags] [newfs-options] [special-device] mount-node
DESCRIPTION
The newfs command creates a new file system on the specified special-device of type disk-type. If the disk has been labeled using the disklabel command, newfs builds a 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 looks up the specified disk type in the /etc/disktab disk description file to get default information on the specified special device. Typically, the defaults are reasonable; however the newfs command has numerous flags that allow you to override the defaults.
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 both commands.
Note that it is possible to use newfs to create a file system on a device that is currently part of a logical volume. This is because the physical disks on which the Logical Volume Manager (LVM) creates logical volumes are not protected from access by other programs.
FLAGS
This section describes the file system dependencies for the UFS file systems.
-NDisplays the file system parameters without creating the file system.
The following newfs-options flags define the general layout policies.
-b block-sizeThe block size of the file system in bytes. Note that the block size is fixed at 8KB.
-f frag-sizeThe fragment size of the file system in bytes.
-m %free_space
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.
-o opt_preference
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.
-a maxcontigThis 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.
-d rotdelayThis specifies the expected time (in milliseconds) to service a transfer completion interrupt and initiate a new transfer on the same disk. The default is 4 milliseconds. See tunefs(8) for more details on how to set this option.
-e maxbpgThis 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.
-i #bytes/inode
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.
-c #cylinders/group
The number of cylinders per cylinder group in a file system. The default value is 16.
-s sizeThe 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.
-r revolutions/minute
The speed of the disk in revolutions per minute.
-S sector-sizeThe size of a sector in bytes (almost never anything but 512).
-u sectors/track
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).
-t #tracks/cylinder
The number of tracks per cylinder available for data allocation by the file system.
-p spare_sectors/track
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.
-x spare_sectors/cylinder
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.
-l hardware_sector_interleave
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.
Thus, an interleave of 1/1 implies contiguous layout, while 1/2 implies logical sector 0 (zero) is separated by one sector from logical sector 1.
-k sector0-skew/track
Used to describe perturbations in the media format to compensate for a slow controller. Track skew is the offset of sector 0 (zero) on track N relative to sector 0 (zero) on track N-1 on the same cylinder.
The following option applies only to mfs:
-F mount-flags
Used for providing a decimal numeric value to be passed as mount flags when running as a memory based file system. This option is primarily intended for use when mfs is started by the mount(8) command.
ERRORS
You may receive the following informational messages when using the newfs command:
Warning: nn sector(s) in last cylinder unallocated
This message is for UFS only. It requires no user action. The message indicates that if nn sectors are added to the size of the file system, it will be an integral number of cylinders. Disk space is not wasted. Usually, cylinder boundaries are ignored when partitions are allocated.
Warning: inode blocks/cyl group (inumber) >= data blocks (dnumber)
in last cylinder group. This implies snumber sector(s) cannot
be allocated
This message requires no user action. It indicates that inumber of file system blocks were needed to allocate the inode table but only dnumber of file system blocks were available in the last cylinder group. The last cylinder group could not be allocated and snumber of sectors are actually wasted.
FILES
/usr/sbin/newfs
Specifies the command path.
/usr/sbin/mfs
Specifies the command path.
/etc/disktab
Provides disk geometry and file system partition information.
RELATED INFORMATION
Commands: chmod(1), disklabel(8), fsck(8), tunefs(8), mount(8)
Files: disktab(4), fstab(4)