1.\" Copyright (c) 1983, 1987, 1991, 1993, 1994 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)newfs.8 8.3 (Berkeley) 3/27/94 33.\" 34.Dd March 27, 1994 35.Dt NEWFS 8 36.Os BSD 4.2 37.Sh NAME 38.Nm newfs , 39.Nm mfs 40.Nd construct a new file system 41.Sh SYNOPSIS 42.Nm newfs 43.Op Fl NO 44.Op Fl S Ar sector-size 45.Op Fl a Ar maxcontig 46.Op Fl b Ar block-size 47.Op Fl c Ar cylinders 48.Op Fl d Ar rotdelay 49.Op Fl e Ar maxbpg 50.Op Fl f Ar frag-size 51.Op Fl i Ar bytes 52.Op Fl k Ar skew 53.Op Fl l Ar interleave 54.Op Fl m Ar free space 55.Op Fl o Ar optimization 56.Op Fl p Ar sectors 57.Op Fl r Ar revolutions 58.Op Fl s Ar size 59.Op Fl t Ar tracks 60.Op Fl u Ar sectors 61.Op Fl x Ar sectors 62.Ar special 63.Nm mount_mfs 64.Op Fl N 65.Op Fl F Ar file 66.Op Fl T Ar disktype 67.Op Fl a Ar maxcontig 68.Op Fl b Ar block-size 69.Op Fl c Ar cylinders 70.Op Fl d Ar rotdelay 71.Op Fl e Ar maxbpg 72.Op Fl f Ar frag-size 73.Op Fl i Ar bytes 74.Op Fl m Ar free space 75.Op Fl o Ar options 76.Op Fl s Ar size 77.Ar special node 78.Sh DESCRIPTION 79.Nm Newfs 80replaces the more obtuse 81.Xr mkfs 8 82program. 83Before running 84.Nm newfs 85or 86.Nm mount_mfs , 87the disk must be labeled using 88.Xr disklabel 8 . 89.Nm Newfs 90builds a file system on the specified special device. 91Typically the defaults are reasonable, however 92.Nm newfs 93has numerous options to allow the defaults to be selectively overridden. 94.Pp 95.Nm Mount_mfs 96is used to build a file system in virtual memory and then mount it 97on a specified node. 98.Nm Mount_mfs 99exits and the contents of the file system are lost 100when the file system is unmounted. 101If 102.Nm mount_mfs 103is sent a signal while running, 104for example during system shutdown, 105it will attempt to unmount its 106corresponding file system. 107The parameters to 108.Nm mount_mfs 109are the same as those to 110.Nm newfs . 111The special file is only used to read the disk label which provides 112a set of configuration parameters for the memory based file system. 113The special file is typically that of the primary swap area, 114since that is where the file system will be backed up when 115free memory gets low and the memory supporting 116the file system has to be paged. 117.Pp 118The following options define the general layout policies. 119.Bl -tag -width Fl 120.It Fl T Ar disktype 121For backward compatibility and for 122.Nm mount_mfs . 123.It Fl F Ar file 124.Nm mount_mfs 125will use this file for the image of the filesystem. When 126.Nm mount_mfs 127exits, this file will be left behind. 128.It Fl N 129Causes the file system parameters to be printed out 130without really creating the file system. 131.It Fl O 132Creates a 4.3BSD format filesystem. 133This options is primarily used to build root filesystems 134that can be understood by older boot ROMs. 135.It Fl a Ar maxcontig 136This specifies the maximum number of contiguous blocks that will be 137laid out before forcing a rotational delay (see the 138.Fl d 139option). 140The default value is one. 141See 142.Xr tunefs 8 143for more details on how to set this option. 144.It Fl b Ar block-size 145The block size of the file system, in bytes. 146.It Fl c Ar #cylinders/group 147The number of cylinders per cylinder group in a file system. 148The default value is 16. 149.It Fl d Ar rotdelay 150This specifies the expected time (in milliseconds) to service a transfer 151completion interrupt and initiate a new transfer on the same disk. 152The default is 0 milliseconds. 153See 154.Xr tunefs 8 155for more details on how to set this option. 156.It Fl e Ar maxbpg 157This indicates the maximum number of blocks any single file can 158allocate out of a cylinder group before it is forced to begin 159allocating blocks from another cylinder group. 160The default is about one quarter of the total blocks in a cylinder group. 161See 162.Xr tunefs 8 163for more details on how to set this option. 164.It Fl f Ar frag-size 165The fragment size of the file system in bytes. 166.It Fl i Ar number of bytes per inode 167This specifies the density of inodes in the file system. 168The default is to create an inode for each 2048 bytes of data space. 169If fewer inodes are desired, a larger number should be used; 170to create more inodes a smaller number should be given. 171.It Fl m Ar free space \&% 172The percentage of space reserved from normal users; the minimum free 173space threshold. 174The default value used is 10%. 175See 176.Xr tunefs 8 177for more details on how to set this option. 178.It Fl n Ar number of distinguished rotational positions 179Determines how many rotational time slots there are in one revolution of 180the disk. Defaults to 1, which escentially disables the rotational position table. 181.It Fl o Ar optimization\ preference 182.Pq ``space'' or ``time'' 183The file system can either be instructed to try to minimize the time spent 184allocating blocks, or to try to minimize the space fragmentation on the disk. 185If the value of minfree (see above) is less than 10%, 186the default is to optimize for space; 187if the value of minfree is greater than or equal to 10%, 188the default is to optimize for time. 189See 190.Xr tunefs 8 191for more details on how to set this option. 192.It Fl s Ar size 193The size of the file system in sectors. 194.El 195.Pp 196The following options override the standard sizes for the disk geometry. 197Their default values are taken from the disk label. 198Changing these defaults is useful only when using 199.Nm newfs 200to build a file system whose raw image will eventually be used on a 201different type of disk than the one on which it is initially created 202(for example on a write-once disk). 203Note that changing any of these values from their defaults will make 204it impossible for 205.Xr fsck 206to find the alternate superblocks if the standard superblock is lost. 207.Bl -tag -width Fl 208.It Fl S Ar sector-size 209The size of a sector in bytes (almost never anything but 512). 210.It Fl k Ar sector \&0 skew , per track 211Used to describe perturbations in the media format to compensate for 212a slow controller. 213Track skew is the offset of sector 0 on track N relative to sector 0 214on track N-1 on the same cylinder. 215.It Fl l Ar hardware sector interleave 216Used to describe perturbations in the media format to compensate for 217a slow controller. 218Interleave is physical sector interleave on each track, 219specified as the denominator of the ratio: 220.Dl sectors read/sectors passed over 221Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies 222logical sector 0 is separated by one sector from logical sector 1. 223.It Fl p Ar spare sectors per track 224Spare sectors (bad sector replacements) are physical sectors that occupy 225space at the end of each track. 226They are not counted as part of the sectors/track 227.Pq Fl u 228since they are not available to the file system for data allocation. 229.It Fl r Ar revolutions/minute 230The speed of the disk in revolutions per minute. 231.It Fl t Ar #tracks/cylinder 232The number of tracks/cylinder available for data allocation by the file 233system. 234The default is 1. 235If zero is specified, the value from the disklabel will be used. 236.It Fl u Ar sectors/track 237The number of sectors per track available for data allocation by the file 238system. 239The default is 4096. 240If zero is specified, the value from the disklabel will be used. 241This does not include sectors reserved at the end of each track for bad 242block replacement (see the 243.Fl p 244option.) 245.It Fl x Ar spare sectors per cylinder 246Spare sectors (bad sector replacements) are physical sectors that occupy 247space at the end of the last track in the cylinder. 248They are deducted from the sectors/track 249.Pq Fl u 250of the last track of each cylinder since they are not available to the file 251system for data allocation. 252.El 253.Pp 254The options to the 255.Nm mount_mfs 256command are as described for the 257.Nm newfs 258command, except for the 259.Fl o 260option. 261.Pp 262That option is as follows: 263.Bl -tag -width indent 264.It Fl o 265Options are specified with a 266.Fl o 267flag followed by a comma separated string of options. 268See the 269.Xr mount 8 270man page for possible options and their meanings. 271.El 272.Sh SEE ALSO 273.Xr disktab 5 , 274.Xr fs 5 , 275.Xr dumpfs 8 , 276.Xr disklabel 8 , 277.Xr diskpart 8 , 278.Xr fsck 8 , 279.Xr format 8 , 280.Xr mount 8 , 281.Xr tunefs 8 282.Rs 283.%A M. McKusick 284.%A W. Joy 285.%A S. Leffler 286.%A R. Fabry 287.%T A Fast File System for UNIX , 288.%J ACM Transactions on Computer Systems 2 289.%V 3 290.%P pp 181-197 291.%D August 1984 292.%O (reprinted in the BSD System Manager's Manual) 293.Re 294.Sh HISTORY 295The 296.Nm 297command appeared in 298.Bx 4.2 . 299