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 May 18, 2002 36.Dt NEWFS 8 37.Os 38.Sh NAME 39.Nm newfs , 40.Nd construct a new file system 41.Sh SYNOPSIS 42.Nm 43.Op Fl NU 44.Op Fl O Ar filesystem-type 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 blocks-per-cylinder-group 50.Op Fl d Ar max-extent-size 51.Op Fl e Ar maxbpg 52.Op Fl f Ar frag-size 53.Op Fl g Ar avgfilesize 54.Op Fl h Ar avgfpdir 55.Op Fl i Ar bytes 56.Op Fl m Ar free-space 57.Op Fl o Ar optimization 58.Op Fl s Ar size 59.Ar special 60.Sh DESCRIPTION 61The 62.Nm 63utility is used to initialize and clear file systems before first use. 64Before running 65.Nm 66the disk must be labeled using 67.Xr disklabel 8 . 68The 69.Nm 70utility builds a file system on the specified special file. 71(We often refer to the 72.Dq special file 73as the 74.Dq disk , 75although the special file need not be a physical disk. 76In fact, it need not even be special.) 77Typically the defaults are reasonable, however 78.Nm 79has numerous options to allow the defaults to be selectively overridden. 80.Pp 81The following options define the general layout policies: 82.Bl -tag -width indent 83.It Fl T Ar disktype 84For backward compatibility. 85.It Fl N 86Cause the file system parameters to be printed out 87without really creating the file system. 88.It Fl O Ar filesystem-type 89Use 1 to specify that a UFS1 format file system be built; 90use 2 to specify that a UFS2 format file system be built. 91The default is UFS1 format, but will eventually be changed to UFS2. 92.It Fl U 93Enables soft updates on the new file system. 94.It Fl a Ar maxcontig 95Specify the maximum number of contiguous blocks that will be 96laid out before forcing a rotational delay. 97The default value is 16. 98See 99.Xr tunefs 8 100for more details on how to set this option. 101.It Fl b Ar block-size 102The block size of the file system, in bytes. 103It must be a power of 2. 104The 105default size is 16384 bytes, and the smallest allowable size is 4096 bytes. 106The optimal block:fragment ratio is 8:1. 107Other ratios are possible, but are not recommended, 108and may produce poor results. 109.It Fl c Ar blocks-per-cylinder-group 110The number of blocks per cylinder group in a file system. 111The default is to compute the maximum allowed by the other parameters. 112This value is 113dependent on a number of other parameters, in particular the block size 114and the number of bytes per inode. 115.It Fl d Ar max-extent-size 116The file system may choose to store large files using extents. 117This parameter specifies the largest extent size that may be used. 118It is presently limited to its default value which is 16 times 119the file system blocksize. 120.It Fl e Ar maxbpg 121Indicate the maximum number of blocks any single file can 122allocate out of a cylinder group before it is forced to begin 123allocating blocks from another cylinder group. 124The default is about one quarter of the total blocks in a cylinder group. 125See 126.Xr tunefs 8 127for more details on how to set this option. 128.It Fl f Ar frag-size 129The fragment size of the file system in bytes. 130It must be a power of two 131ranging in value between 132.Ar blocksize Ns /8 133and 134.Ar blocksize . 135The default is 2048 bytes. 136.It Fl g Ar avgfilesize 137The expected average file size for the file system. 138.It Fl h Ar avgfpdir 139The expected average number of files per directory on the file system. 140.It Fl i Ar bytes 141Specify the density of inodes in the file system. 142The default is to create an inode for every 143.Pq 4 * Ar frag-size 144bytes of data space. 145If fewer inodes are desired, a larger number should be used; 146to create more inodes a smaller number should be given. 147One inode is required for each distinct file, so this value effectively 148specifies the average file size on the file system. 149.It Fl m Ar free-space 150The percentage of space reserved from normal users; the minimum free 151space threshold. 152The default value used is 153defined by 154.Dv MINFREE 155from 156.Aq Pa ufs/ffs/fs.h , 157currently 8%. 158See 159.Xr tunefs 8 160for more details on how to set this option. 161.It Fl o Ar optimization 162.Cm ( space 163or 164.Cm time ) . 165The file system can either be instructed to try to minimize the time spent 166allocating blocks, or to try to minimize the space fragmentation on the disk. 167If the value of minfree (see above) is less than 8%, 168the default is to optimize for 169.Cm space ; 170if the value of minfree is greater than or equal to 8%, 171the default is to optimize for 172.Cm time . 173See 174.Xr tunefs 8 175for more details on how to set this option. 176.It Fl s Ar size 177The size of the file system in sectors. 178This value defaults to the size of the 179raw partition specified in 180.Ar special 181(in other words, 182.Nm 183will use the entire partition for the file system). 184.El 185.Pp 186The following options override the standard sizes for the disk geometry. 187Their default values are taken from the disk label. 188Changing these defaults is useful only when using 189.Nm 190to build a file system whose raw image will eventually be used on a 191different type of disk than the one on which it is initially created 192(for example on a write-once disk). 193Note that changing any of these values from their defaults will make 194it impossible for 195.Xr fsck 8 196to find the alternate superblocks if the standard superblock is lost. 197.Bl -tag -width indent 198.It Fl S Ar sector-size 199The size of a sector in bytes (almost never anything but 512). 200.El 201.Sh EXAMPLES 202.Dl newfs /dev/ad3s1a 203.Pp 204Creates a new ufs file system on 205.Pa ad3s1a . 206The 207.Nm 208utility will use a block size of 16384 bytes, a fragment size of 2048 bytes 209and the largest possible number of blocks per cylinders group. 210These values tend to produce better performance for most applications 211than the historical defaults 212(8192 byte block size and 1024 byte fragment size). 213This large fragment size may lead to much wasted space 214on file systems that contain many small files. 215.Sh SEE ALSO 216.Xr fdformat 1 , 217.Xr disktab 5 , 218.Xr fs 5 , 219.Xr camcontrol 8 , 220.Xr disklabel 8 , 221.Xr diskpart 8 , 222.Xr dumpfs 8 , 223.Xr fsck 8 , 224.Xr mount 8 , 225.Xr tunefs 8 , 226.Xr vinum 8 227.Rs 228.%A M. McKusick 229.%A W. Joy 230.%A S. Leffler 231.%A R. Fabry 232.%T A Fast File System for UNIX 233.%J ACM Transactions on Computer Systems 2 234.%V 3 235.%P pp 181-197 236.%D August 1984 237.%O (reprinted in the BSD System Manager's Manual) 238.Re 239.Sh HISTORY 240The 241.Nm 242utility appeared in 243.Bx 4.2 . 244