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