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 29, 2001 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 NOU 44.Op Fl S Ar sector-size 45.Op Fl T Ar disktype 46.Op Fl a Ar maxcontig 47.Op Fl b Ar block-size 48.Op Fl c Ar cylinders 49.Op Fl e Ar maxbpg 50.Op Fl f Ar frag-size 51.Op Fl g Ar avgfilesize 52.Op Fl h Ar avfpdir 53.Op Fl i Ar bytes 54.Op Fl m Ar free space 55.Op Fl o Ar optimization 56.Op Fl s Ar size 57.Op Fl u Ar sectors 58.Op Fl v 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 file system 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 file system parameters to be printed out 85without really creating the file system. 86.It Fl U 87Enables soft updates on the new filesystem. 88.It Fl a Ar maxcontig 89Specify the maximum number of contiguous blocks that will be 90laid out before forcing a rotational delay. 91The default value is 1. 92See 93.Xr tunefs 8 94for more details on how to set this option. 95.It Fl b Ar block-size 96The block size of the file system, in bytes. It must be a power of 2. The 97default size is 16384 bytes, and the smallest allowable size is 4096 bytes. 98The optimal block:fragment ratio is 8:1. 99Other ratios are possible, but are not recommended, 100and may produce unpredictable results. 101.It Fl c Ar #cylinders/group 102The number of cylinders per cylinder group in a file system. The default 103is to compute the maximum allowed by the other parameters. This value is 104dependent on a number of other parameters, in particular the block size 105and the number of bytes per inode. 106.It Fl e Ar maxbpg 107Indicate the maximum number of blocks any single file can 108allocate out of a cylinder group before it is forced to begin 109allocating blocks from another cylinder group. 110The default is about one quarter of the total blocks in a cylinder group. 111See 112.Xr tunefs 8 113for more details on how to set this option. 114.It Fl f Ar frag-size 115The fragment size of the file system in bytes. It must be a power of two 116ranging in value between 117.Ar blocksize Ns /8 118and 119.Ar blocksize . 120The default is 2048 bytes. 121.It Fl g Ar avgfilesize 122The expected average file size for the file system. 123.It Fl h Ar avgfpdir 124The expected average number of files per directory on the file system. 125.It Fl i Ar number of bytes per inode 126Specify the density of inodes in the file system. 127The default is to create an inode for every 128.Pq 4 * Ar frag-size 129bytes of data space. 130If fewer inodes are desired, a larger number should be used; 131to create more inodes a smaller number should be given. 132One inode is required for each distinct file, so this value effectively 133specifies the average file size on the file system. 134.It Fl m Ar free space \&% 135The percentage of space reserved from normal users; the minimum free 136space threshold. 137The default value used is 138defined by 139.Dv MINFREE 140from 141.Aq Pa ufs/ffs/fs.h , 142currently 8%. 143See 144.Xr tunefs 8 145for more details on how to set this option. 146.It Fl o Ar optimization\ preference 147.Pq Ar space No or Ar time . 148The file system can either be instructed to try to minimize the time spent 149allocating blocks, or to try to minimize the space fragmentation on the disk. 150If the value of minfree (see above) is less than 8%, 151the default is to optimize for 152.Ar space ; 153if the value of minfree is greater than or equal to 8%, 154the default is to optimize for 155.Ar time . 156See 157.Xr tunefs 8 158for more details on how to set this option. 159.It Fl s Ar size 160The size of the file system in sectors. This value defaults to the size of the 161raw partition specified in 162.Ar special 163(in other words, 164.Nm 165will use the entire partition for the file system). 166.It Fl v 167Specify that the disk does not contain any partitions, and that 168.Nm 169should build a file system on the whole disk. 170This option is useful for synthetic disks such as 171.Nm vinum . 172.El 173.Pp 174The following options override the standard sizes for the disk geometry. 175Their default values are taken from the disk label. 176Changing these defaults is useful only when using 177.Nm 178to build a file system whose raw image will eventually be used on a 179different type of disk than the one on which it is initially created 180(for example on a write-once disk). 181Note that changing any of these values from their defaults will make 182it impossible for 183.Xr fsck 8 184to find the alternate superblocks if the standard superblock is lost. 185.Bl -tag -width indent 186.It Fl S Ar sector-size 187The size of a sector in bytes (almost never anything but 512). 188.It Fl u Ar sectors/cylinders 189The number of sectors per cylinder available for data allocation by the file 190system. 191The default is 4096. 192If zero is specified, the value from the disklabel will be used. 193.El 194.Sh EXAMPLES 195.Dl newfs /dev/ad3s1a 196.Pp 197Creates a new ufs file system on 198.Pa ad3s1a . 199.Nm 200will use a block size of 16384 bytes, a fragment size of 2048 bytes 201and the largest possible number of cylinders per group. 202These values tend to produce better performance for most applications 203than the historical defaults 204(8192 byte block size and 1024 byte fragment size). 205This large fragment size 206may lead to large amounts of wasted space 207on filesystems that contain a large number of 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 235command appeared in 236.Bx 4.2 . 237