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