1.\" Copyright (c) 1983, 1987, 1991 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)newfs.8 6.10 (Berkeley) 03/16/91 7.\" 8.Dd 9.Dt NEWFS 8 10.Os BSD 4.2 11.Sh NAME 12.Nm newfs , 13.Nm mfs 14.Nd construct a new file system 15.Sh SYNOPSIS 16.Nm newfs 17.Op Fl N 18.Op Ar newfs-options 19.Ar special 20.Nm mfs 21.Op Fl F Ar mount_flags 22.Op Ar newfs-options 23.Ar special node 24.Sh DESCRIPTION 25.Nm Newfs 26replaces the more obtuse 27.Xr mkfs 8 28program. 29Before running 30.Nm newfs 31or 32.Nm mfs , 33the disk must be labeled using 34.Xr disklabel 8 . 35.Nm Newfs 36builds a file system on the specified special device 37basing its defaults on the information in the disk label. 38Typically the defaults are reasonable, however 39.Nm newfs 40has numerous options to allow the defaults to be selectively overridden. 41.Pp 42.Nm Mfs 43is used to build a file system in virtual memory and then mount it 44on a specified node. 45.Nm Mfs 46exits and the contents of the file system are lost 47when the file system is unmounted. 48If 49.Nm mfs 50is sent a signal while running, 51for example during system shutdown, 52it will attempt to unmount its 53corresponding file system. 54The parameters to 55.Nm mfs 56are the same as those to 57.Nm newfs . 58The special file is only used to read the disk label which provides 59a set of configuration parameters for the memory based file system. 60The special file is typically that of the primary swap area, 61since that is where the file system will be backed up when 62free memory gets low and the memory supporting 63the file system has to be paged. 64.Pp 65The following options define the general layout policies. 66.Bl -tag -width Fl 67.It Fl N 68Causes the file system parameters to be printed out 69without really creating the file system. 70.It Fl b Ar block-size 71The block size of the file system in bytes. 72.It Fl f Ar frag-size 73The fragment size of the file system in bytes. 74.It Fl m Ar free space \&% 75The percentage of space reserved from normal users; the minimum 76free space threshold. The default value used is 10%. 77See 78.Xr tunefs 8 79for more details on how to set this option. 80.It Fl o Ar optimization\ preference 81.Pq ``space'' or ``time'' 82The file system can either be instructed to try to minimize the time spent 83allocating blocks, or to try to minimize the space fragmentation on the disk. 84If the value of minfree (see above) is less than 10%, 85the default is to optimize for space; 86if the value of minfree greater than or equal to 10%, 87the default is to optimize for time. 88See 89.Xr tunefs 8 90for more details on how to set this option. 91.It Fl a Ar maxcontig 92This specifies the maximum number of contiguous blocks that will 93be laid out before forcing a rotational delay (see 94.Fl d 95below). 96The default value is one. 97See 98.Xr tunefs 8 99for more details on how to set this option. 100.It Fl d Ar rotdelay 101This specifies the expected time (in milliseconds) 102to service a transfer completion 103interrupt and initiate a new transfer on the same disk. 104The default is 4 milliseconds. 105See 106.Xr tunefs 8 107for more details on how to set this option. 108.It Fl e Ar maxbpg 109This indicates the maximum number of blocks any single file can 110allocate out of a cylinder group before it is forced to begin 111allocating blocks from another cylinder group. 112The default is about one quarter of the total blocks in a cylinder group. 113See 114.Xr tunefs 8 115for more details on how to set this option. 116.It Fl i Ar number of bytes per inode 117This specifies the density of inodes in the file system. 118The default is to create an inode for each 2048 bytes of data space. 119If fewer inodes are desired, a larger number should be used; 120to create more inodes a smaller number should be given. 121.It Fl c Ar #cylinders/group 122The number of cylinders per cylinder group in a file system. 123The default value used is 16. 124.It Fl s Ar size 125The size of the file system in sectors. 126.Pp 127The following options override the standard sizes for the disk geometry. 128Their default values are taken from the disk label. 129Changing these defaults is useful only when using 130.Nm newfs 131to build a file system whose raw image will eventually be used 132on a different type of disk than the one on which it is initially 133created (for example on a write-once disk). 134Note that changing any of these values from their 135defaults will make it impossible for 136.Xr fsck 137to find the alternate superblocks if the standard super block is lost. 138.It Fl r Ar revolutions/minute 139The speed of the disk in revolutions per minute. 140.It Fl S Ar sector-size 141The size of a sector in bytes (almost never anything but 512). 142.It Fl u Ar sectors/track 143The number of sectors per track available for data 144allocation by the file system. This does not 145include sectors reserved at the end of each track 146for bad block replacement (see 147.Fl p 148below). 149.It Fl t Ar #tracks/cylinder 150The number of tracks/cylinder available for data 151allocation by the file system. 152.It Fl p Ar spare sectors per track 153Spare sectors (bad sector replacements) are physical sectors 154that occupy space at the end of each track. 155They are not counted as part of the sectors/track 156.Pq Fl u 157since they are not available to the file system for data allocation. 158.It Fl x Ar spare sectors per cylinder 159Spare sectors (bad sector replacements) are physical sectors 160that occupy space at the end of the last track in the cylinder. 161They are deducted from the sectors/track 162.Pq Fl u 163of the last track of each cylinder 164since they are not available to the file system for data allocation. 165.It Fl l Ar hardware sector interleave 166Used to describe perturbations in the media format to 167compensate for a slow controller. 168Interleave is physical sector interleave on each track, 169specified as the denominator of the ratio: 170.Dl sectors read/sectors passed over 171Thus an interleave of 1/1 implies contiguous layout, while 1/2 172implies logical sector 0 is separated by one sector from logical 173sector 1. 174.It Fl k Ar sector \&0 skew , per track 175Used to describe perturbations in the media format to 176compensate for a slow controller. 177Track skew is the offset of sector 0 on track N 178relative to sector 0 on track N-1 on the same cylinder. 179.Pp 180.El 181The following option applies only to 182.Nm mfs . 183.Bl -tag -width Fl 184.It Fl F Ar mount flags 185Used to pass in a decimal numeric value to be passed 186as mount flags when running as a memory based file system. 187This option is primarily intended for use when 188.Nm mfs 189is started by the 190.Xr mount 8 191command. 192.El 193.Sh SEE ALSO 194.Xr disktab 5 , 195.Xr fs 5 , 196.Xr disklabel 8 , 197.Xr diskpart 8 , 198.Xr fsck 8 , 199.Xr format 8 , 200.Xr tunefs 8 201.Rs 202.%A M. McKusick 203.%A W. Joy 204.%A S. Leffler 205.%A R. Fabry 206.%T A Fast File System for UNIX , 207.%J ACM Transactions on Computer Systems 2 208.%V 3 209.%P pp 181-197 210.%D August 1984 211.%O (reprinted in the BSD System Manager's Manual) 212.Re 213.Sh HISTORY 214The 215.Nm 216command appeared in 217.Bx 4.2 . 218