1.\" Copyright (c) 1983, 1987, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)newfs.8 8.2 (Berkeley) 12/11/93 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 mount_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 mount_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 Mount_mfs 43is used to build a file system in virtual memory and then mount it 44on a specified node. 45.Nm Mount_mfs 46exits and the contents of the file system are lost 47when the file system is unmounted. 48If 49.Nm mount_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 mount_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 O 71Creates a 4.3BSD format filesystem. 72This options is primarily used to build root filesystems 73that can be understood by older boot ROMs. 74.It Fl b Ar block-size 75The block size of the file system in bytes. 76.It Fl f Ar frag-size 77The fragment size of the file system in bytes. 78.It Fl m Ar free space \&% 79The percentage of space reserved from normal users; the minimum 80free space threshold. The default value used is 10%. 81See 82.Xr tunefs 8 83for more details on how to set this option. 84.It Fl o Ar optimization\ preference 85.Pq ``space'' or ``time'' 86The file system can either be instructed to try to minimize the time spent 87allocating blocks, or to try to minimize the space fragmentation on the disk. 88If the value of minfree (see above) is less than 10%, 89the default is to optimize for space; 90if the value of minfree is greater than or equal to 10%, 91the default is to optimize for time. 92See 93.Xr tunefs 8 94for more details on how to set this option. 95.It Fl a Ar maxcontig 96This specifies the maximum number of contiguous blocks that will 97be laid out before forcing a rotational delay (see 98.Fl d 99below). 100The default value is one. 101See 102.Xr tunefs 8 103for more details on how to set this option. 104.It Fl d Ar rotdelay 105This specifies the expected time (in milliseconds) 106to service a transfer completion 107interrupt and initiate a new transfer on the same disk. 108The default is 4 milliseconds. 109See 110.Xr tunefs 8 111for more details on how to set this option. 112.It Fl e Ar maxbpg 113This indicates the maximum number of blocks any single file can 114allocate out of a cylinder group before it is forced to begin 115allocating blocks from another cylinder group. 116The default is about one quarter of the total blocks in a cylinder group. 117See 118.Xr tunefs 8 119for more details on how to set this option. 120.It Fl i Ar number of bytes per inode 121This specifies the density of inodes in the file system. 122The default is to create an inode for each 2048 bytes of data space. 123If fewer inodes are desired, a larger number should be used; 124to create more inodes a smaller number should be given. 125.It Fl c Ar #cylinders/group 126The number of cylinders per cylinder group in a file system. 127The default value used is 16. 128.It Fl s Ar size 129The size of the file system in sectors. 130.Pp 131The following options override the standard sizes for the disk geometry. 132Their default values are taken from the disk label. 133Changing these defaults is useful only when using 134.Nm newfs 135to build a file system whose raw image will eventually be used 136on a different type of disk than the one on which it is initially 137created (for example on a write-once disk). 138Note that changing any of these values from their 139defaults will make it impossible for 140.Xr fsck 141to find the alternate superblocks if the standard superblock is lost. 142.It Fl r Ar revolutions/minute 143The speed of the disk in revolutions per minute. 144.It Fl S Ar sector-size 145The size of a sector in bytes (almost never anything but 512). 146.It Fl u Ar sectors/track 147The number of sectors per track available for data 148allocation by the file system. This does not 149include sectors reserved at the end of each track 150for bad block replacement (see 151.Fl p 152below). 153.It Fl t Ar #tracks/cylinder 154The number of tracks/cylinder available for data 155allocation by the file system. 156.It Fl p Ar spare sectors per track 157Spare sectors (bad sector replacements) are physical sectors 158that occupy space at the end of each track. 159They are not counted as part of the sectors/track 160.Pq Fl u 161since they are not available to the file system for data allocation. 162.It Fl x Ar spare sectors per cylinder 163Spare sectors (bad sector replacements) are physical sectors 164that occupy space at the end of the last track in the cylinder. 165They are deducted from the sectors/track 166.Pq Fl u 167of the last track of each cylinder 168since they are not available to the file system for data allocation. 169.It Fl l Ar hardware sector interleave 170Used to describe perturbations in the media format to 171compensate for a slow controller. 172Interleave is physical sector interleave on each track, 173specified as the denominator of the ratio: 174.Dl sectors read/sectors passed over 175Thus an interleave of 1/1 implies contiguous layout, while 1/2 176implies logical sector 0 is separated by one sector from logical 177sector 1. 178.It Fl k Ar sector \&0 skew , per track 179Used to describe perturbations in the media format to 180compensate for a slow controller. 181Track skew is the offset of sector 0 on track N 182relative to sector 0 on track N-1 on the same cylinder. 183.Pp 184.El 185The following option applies only to 186.Nm mount_mfs . 187.Bl -tag -width Fl 188.It Fl F Ar mount flags 189Used to pass in a decimal numeric value to be passed 190as mount flags when running as a memory based file system. 191This option is primarily intended for use when 192.Nm mount_mfs 193is started by the 194.Xr mount 8 195command. 196.El 197.Sh SEE ALSO 198.Xr disktab 5 , 199.Xr fs 5 , 200.Xr dumpfs 8 , 201.Xr disklabel 8 , 202.Xr diskpart 8 , 203.Xr fsck 8 , 204.Xr format 8 , 205.Xr tunefs 8 206.Rs 207.%A M. McKusick 208.%A W. Joy 209.%A S. Leffler 210.%A R. Fabry 211.%T A Fast File System for UNIX , 212.%J ACM Transactions on Computer Systems 2 213.%V 3 214.%P pp 181-197 215.%D August 1984 216.%O (reprinted in the BSD System Manager's Manual) 217.Re 218.Sh HISTORY 219The 220.Nm 221command appeared in 222.Bx 4.2 . 223