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.6 (Berkeley) 5/3/95 33.\" $FreeBSD$ 34.\" 35.Dd December 19, 2000 36.Dt NEWFS 8 37.Os BSD 4.2 38.Sh NAME 39.Nm newfs , 40.Nm mount_mfs 41.Nd construct a new file system 42.Sh SYNOPSIS 43.Nm 44.Op Fl NOU 45.Op Fl S Ar sector-size 46.Op Fl T Ar disktype 47.Op Fl a Ar maxcontig 48.Op Fl b Ar block-size 49.Op Fl c Ar cylinders 50.Op Fl d Ar rotdelay 51.Op Fl e Ar maxbpg 52.Op Fl f Ar frag-size 53.Op Fl g Ar avgfilesize 54.Op Fl h Ar avfpdir 55.Op Fl i Ar bytes 56.Op Fl k Ar skew 57.Op Fl l Ar interleave 58.Op Fl m Ar free space 59.Op Fl n Ar rotational positions 60.Op Fl o Ar optimization 61.Op Fl p Ar sectors 62.Op Fl r Ar revolutions 63.Op Fl s Ar size 64.Op Fl t Ar tracks 65.Op Fl u Ar sectors 66.Op Fl v 67.Op Fl x Ar sectors 68.Ar special 69.Nm mount_mfs 70.Op Fl NU 71.Op Fl F Ar file 72.Op Fl T Ar disktype 73.Op Fl a Ar maxcontig 74.Op Fl b Ar block-size 75.Op Fl c Ar cylinders 76.Op Fl d Ar rotdelay 77.Op Fl e Ar maxbpg 78.Op Fl f Ar frag-size 79.Op Fl i Ar bytes 80.Op Fl m Ar free space 81.Op Fl n Ar rotational positions 82.Op Fl o Ar options 83.Op Fl s Ar size 84.Ar special node 85.Sh WARNING 86.Nm mount_mfs 87is being phased out. 88Please see 89.Xr mdconfig 8 90for the replacement. 91.Sh DESCRIPTION 92.Nm Newfs 93is used to initialize and clear filesystems before first use. 94Before running 95.Nm 96or 97.Nm mount_mfs , 98the disk must be labeled using 99.Xr disklabel 8 . 100.Nm Newfs 101builds a file system on the specified special file. 102(We often refer to the 103.Dq special file 104as the 105.Dq disk , 106although the special file need not be a physical disk. 107In fact, it need not even be special.) 108Typically the defaults are reasonable, however 109.Nm 110has numerous options to allow the defaults to be selectively overridden. 111.Pp 112.Nm Mount_mfs 113is used to build a file system in virtual memory and then mount it 114on a specified node. 115.Nm Mount_mfs 116exits and the contents of the file system are lost 117when the file system is unmounted. 118If 119.Nm mount_mfs 120is sent a signal while running, 121for example during system shutdown, 122it will attempt to unmount its 123corresponding file system. 124The parameters to 125.Nm mount_mfs 126are the same as those to 127.Nm . 128If the 129.Fl T 130flag is specified (see below), the special file is unused. 131Otherwise, it is only used to read the disk label which provides 132a set of configuration parameters for the memory based file system. 133The special file is typically that of the primary swap area, 134since that is where the file system will be backed up when 135free memory gets low and the memory supporting 136the file system has to be paged. 137.Pp 138The following options define the general layout policies: 139.Bl -tag -width indent 140.It Fl T Ar disktype 141For backward compatibility and for 142.Nm mount_mfs . 143.It Fl F Ar file 144.Nm Mount_mfs 145will use this file for the image of the filesystem. When 146.Nm mount_mfs 147exits, this file will be left behind. 148.It Fl N 149Cause the file system parameters to be printed out 150without really creating the file system. 151.It Fl O 152Create a 153.Bx 4.3 154format filesystem. 155This options is primarily used to build root filesystems 156that can be understood by older boot ROMs. 157.It Fl T 158Use information for the specified disk from 159.Pa /etc/disktab 160instead of trying to get the information from a disklabel. 161.It Fl U 162Enables soft updates on the new filesystem. 163.It Fl a Ar maxcontig 164Specify the maximum number of contiguous blocks that will be 165laid out before forcing a rotational delay (see the 166.Fl d 167option). 168The default value is 1. 169See 170.Xr tunefs 8 171for more details on how to set this option. 172.It Fl b Ar block-size 173The block size of the file system, in bytes. It must be a power of 2. The 174default size is 8192 bytes, and the smallest allowable size is 4096 bytes. 175.It Fl c Ar #cylinders/group 176The number of cylinders per cylinder group in a file system. The default value 177is 22. The maximum value is dependent on a number of other parameters, in 178particular the block size. The best way to find the maximum value for a 179specific file system is to attempt to specify a value which is far too large: 180.Nm 181will print out the maximum value. 182.It Fl d Ar rotdelay 183This parameter once specified the minimum time in milliseconds required to 184initiate another disk transfer on the same cylinder. It was used in determining 185the rotationally optimal layout for disk blocks within a file. Modern disks 186with read/write-behind achieve higher performance with this feature disabled, so 187this value should be left at the default value of 0 milliseconds. See 188.Xr tunefs 8 189for more details on how to set this option. 190.It Fl e Ar maxbpg 191Indicate the maximum number of blocks any single file can 192allocate out of a cylinder group before it is forced to begin 193allocating blocks from another cylinder group. 194The default is about one quarter of the total blocks in a cylinder group. 195See 196.Xr tunefs 8 197for more details on how to set this option. 198.It Fl f Ar frag-size 199The fragment size of the file system in bytes. It must be a power of two 200ranging in value between 201.Ar blocksize Ns /8 202and 203.Ar blocksize . 204The default is 1024 bytes. 205.It Fl g Ar avgfilesize 206The expected average file size for the file system. 207.It Fl h Ar avgfpdir 208The expected average number of files per directory on the file system. 209.It Fl i Ar number of bytes per inode 210Specify the density of inodes in the file system. 211The default is to create an inode for every 212.Pq 4 * Ar frag-size 213bytes of data space. 214If fewer inodes are desired, a larger number should be used; 215to create more inodes a smaller number should be given. 216One inode is required for each distinct file, so this value effectively 217specifies the average file size on the file system. 218.It Fl m Ar free space \&% 219The percentage of space reserved from normal users; the minimum free 220space threshold. 221The default value used is 222defined by 223.Dv MINFREE 224from 225.Aq Pa ufs/ffs/fs.h , 226currently 8%. 227See 228.Xr tunefs 8 229for more details on how to set this option. 230.It Fl n Ar number of distinguished rotational positions 231UFS has the ability to keep track of the availability of blocks at different 232rotational positions, so that it could lay out the data to be picked up with 233minimum rotational latency. This parameter specifies the default number of 234rotational positions to distinguish. 235.Pp 236Nowadays this value should be set to 1 (which essentially disables the 237rotational position table) because modern drives with read-ahead and 238write-behind do better without the rotational position table. 239.It Fl o Ar optimization\ preference 240.Pq Ar space No or Ar time . 241The file system can either be instructed to try to minimize the time spent 242allocating blocks, or to try to minimize the space fragmentation on the disk. 243If the value of minfree (see above) is less than 8%, 244the default is to optimize for 245.Ar space ; 246if the value of minfree is greater than or equal to 8%, 247the default is to optimize for 248.Ar time . 249See 250.Xr tunefs 8 251for more details on how to set this option. 252.It Fl s Ar size 253The size of the file system in sectors. This value defaults to the size of the 254raw partition specified in 255.Ar special 256(in other words, 257.Nm 258will use the entire partition for the file system). 259.It Fl v 260Specify that the disk does not contain any partitions, and that 261.Nm 262should build a file system on the whole disk. 263This option is useful for synthetic disks such as 264.Nm vinum . 265.El 266.Pp 267The following options override the standard sizes for the disk geometry. 268Their default values are taken from the disk label. 269Changing these defaults is useful only when using 270.Nm 271to build a file system whose raw image will eventually be used on a 272different type of disk than the one on which it is initially created 273(for example on a write-once disk). 274Note that changing any of these values from their defaults will make 275it impossible for 276.Xr fsck 8 277to find the alternate superblocks if the standard superblock is lost. 278.Bl -tag -width indent 279.It Fl S Ar sector-size 280The size of a sector in bytes (almost never anything but 512). 281.It Fl k Ar sector \&0 skew , per track 282Used to describe perturbations in the media format to compensate for 283a slow controller. 284Track skew is the offset of sector 0 on track N relative to sector 0 285on track N-1 on the same cylinder. 286This option is of historical importance only; modern controllers are always fast 287enough to handle operations back-to-back. 288.It Fl l Ar hardware sector interleave 289Used to describe perturbations in the media format to compensate for 290a slow controller. 291Interleave is physical sector interleave on each track, 292specified as the denominator of the ratio: 293.Dl sectors read/sectors passed over 294Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies 295logical sector 0 is separated by one sector from logical sector 1. 296This option is of historical importance only; the physical sector layout of 297modern disks is not visible from outside. 298.It Fl p Ar spare sectors per track 299Spare sectors (bad sector replacements) are physical sectors that occupy 300space at the end of each track. 301They are not counted as part of the sectors/track 302.Pq Fl u 303since they are not available to the file system for data allocation. 304This option is of historical importance only. Modern disks perform their own 305bad sector allocation. 306.It Fl r Ar revolutions/minute 307The speed of the disk in revolutions per minute. This value is no longer of 308interest, since all the parameters which depend on it are usually disabled. 309.It Fl t Ar #tracks/cylinder 310The number of tracks/cylinder available for data allocation by the file 311system. 312The default is 1. 313If zero is specified, the value from the disklabel will be used. 314.It Fl u Ar sectors/track 315The number of sectors per track available for data allocation by the file 316system. 317The default is 4096. 318If zero is specified, the value from the disklabel will be used. 319This does not include sectors reserved at the end of each track for bad 320block replacement (see the 321.Fl p 322option). 323.It Fl x Ar spare sectors per cylinder 324Spare sectors (bad sector replacements) are physical sectors that occupy 325space at the end of the last track in the cylinder. 326They are deducted from the sectors/track 327.Pq Fl u 328of the last track of each cylinder since they are not available to the file 329system for data allocation. 330This option is of historical importance only. Modern disks perform their own 331bad sector allocation. 332.El 333.Pp 334The options to the 335.Nm mount_mfs 336command are as described for the 337.Nm 338command, except for the 339.Fl o 340option. 341.Pp 342That option is as follows: 343.Bl -tag -width indent 344.It Fl o 345Options are specified with a 346.Fl o 347flag followed by a comma separated string of options. 348See the 349.Xr mount 8 350man page for possible options and their meanings. 351.El 352.Sh EXAMPLES 353.Pp 354.Dl newfs -b 16384 -f 4096 -c 100 /dev/ad3s1a 355.Pp 356Creates a new ufs file system on 357.Pa ad3s1a . 358.Nm 359will use a block size of 16384 bytes, a fragement size of 4096 bytes 360and have 100 cylinders per cylinder group rather than the defaults. 361These values are tend to produce better performance than the defaults 362for file systems larger than about 5 gigabytes. 363.Pp 364.Dl mount_mfs -s 131072 -o nosuid,nodev /dev/da0s1b /tmp 365.Pp 366Mount a 64 MB large memory file system on 367.Pa /tmp , 368with 369.Xr mount 8 370options 371.Ar nosuid 372and 373.Ar nodev . 374.Sh SEE ALSO 375.Xr fdformat 1 , 376.Xr disktab 5 , 377.Xr fs 5 , 378.Xr camcontrol 8 , 379.Xr disklabel 8 , 380.Xr diskpart 8 , 381.Xr dumpfs 8 , 382.Xr fsck 8 , 383.Xr mount 8 , 384.Xr tunefs 8 , 385.Xr vinum 8 386.Rs 387.%A M. McKusick 388.%A W. Joy 389.%A S. Leffler 390.%A R. Fabry 391.%T A Fast File System for UNIX 392.%J ACM Transactions on Computer Systems 2 393.%V 3 394.%P pp 181-197 395.%D August 1984 396.%O (reprinted in the BSD System Manager's Manual) 397.Re 398.Sh HISTORY 399The 400.Nm 401command appeared in 402.Bx 4.2 . 403