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