1 .\" Copyright (c) 1983, 1987, 1991, 1993, 1994
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)newfs.8 8.6 (Berkeley) 5/3/95
36 .Nd construct a new UFS1/UFS2 file system
41 .Op Fl O Ar filesystem-type
42 .Op Fl S Ar sector-size
45 .Op Fl b Ar block-size
46 .Op Fl c Ar blocks-per-cylinder-group
47 .Op Fl d Ar max-extent-size
50 .Op Fl g Ar avgfilesize
53 .Op Fl m Ar free-space
54 .Op Fl o Ar optimization
61 utility is used to initialize and clear file systems before first use.
64 utility builds a file system on the specified special file.
65 (We often refer to the
69 although the special file need not be a physical disk.
70 In fact, it need not even be special.)
71 Typically the defaults are reasonable, however
73 has numerous options to allow the defaults to be selectively overridden.
75 The following options define the general layout policies:
76 .Bl -tag -width indent
78 Erase the content of the disk before making the filesystem.
79 The reserved area in front of the superblock (for bootcode) will not be erased.
81 This is a relevant option for flash based storage devices that use
82 wear levelling algorithms.
84 NB: Erasing may take as long time as writing every sector on the disk.
86 Enable journaling on the new file system via gjournal.
88 Add a volume label to the new file system.
90 Cause the file system parameters to be printed out
91 without really creating the file system.
92 .It Fl O Ar filesystem-type
93 Use 1 to specify that a UFS1 format file system be built;
94 use 2 to specify that a UFS2 format file system be built.
95 The default format is UFS2.
97 For backward compatibility.
99 Enable soft updates on the new file system.
100 .It Fl a Ar maxcontig
101 Specify the maximum number of contiguous blocks that will be
102 laid out before forcing a rotational delay.
103 The default value is 16.
106 for more details on how to set this option.
107 .It Fl b Ar block-size
108 The block size of the file system, in bytes.
109 It must be a power of 2.
111 default size is 16384 bytes, and the smallest allowable size is 4096 bytes.
112 The optimal block:fragment ratio is 8:1.
113 Other ratios are possible, but are not recommended,
114 and may produce poor results.
115 .It Fl c Ar blocks-per-cylinder-group
116 The number of blocks per cylinder group in a file system.
117 The default is to compute the maximum allowed by the other parameters.
119 dependent on a number of other parameters, in particular the block size
120 and the number of bytes per inode.
121 .It Fl d Ar max-extent-size
122 The file system may choose to store large files using extents.
123 This parameter specifies the largest extent size that may be used.
124 It is presently limited to its default value which is 16 times
125 the file system blocksize.
127 Indicate the maximum number of blocks any single file can
128 allocate out of a cylinder group before it is forced to begin
129 allocating blocks from another cylinder group.
130 The default is about one quarter of the total blocks in a cylinder group.
133 for more details on how to set this option.
134 .It Fl f Ar frag-size
135 The fragment size of the file system in bytes.
136 It must be a power of two
137 ranging in value between
141 The default is 2048 bytes.
142 .It Fl g Ar avgfilesize
143 The expected average file size for the file system.
145 The expected average number of files per directory on the file system.
147 Specify the density of inodes in the file system.
148 The default is to create an inode for every
151 If fewer inodes are desired, a larger number should be used;
152 to create more inodes a smaller number should be given.
153 One inode is required for each distinct file, so this value effectively
154 specifies the average file size on the file system.
156 Enable multilabel MAC on the new file system.
157 .It Fl m Ar free-space
158 The percentage of space reserved from normal users; the minimum free
160 The default value used is
168 for more details on how to set this option.
172 directory on the new file system.
173 The resulting file system will not support snapshot generation, so
175 in live mode and background
177 will not function properly.
182 will work on the file system.
183 This option is intended primarily for memory or vnode-backed file systems that
189 .It Fl o Ar optimization
193 The file system can either be instructed to try to minimize the time spent
194 allocating blocks, or to try to minimize the space fragmentation on the disk.
195 If the value of minfree (see above) is less than 8%,
196 the default is to optimize for
198 if the value of minfree is greater than or equal to 8%,
199 the default is to optimize for
203 for more details on how to set this option.
205 The size, in sectors, of reserved space
206 at the end of the partition specified in
208 This space will not be occupied by the file system;
209 it can be used by other consumers such as
213 The size of the file system in sectors.
214 This value defaults to the size of the
215 raw partition specified in
219 space at its end (see
223 of 0 can also be used to choose the default value.
226 value cannot be larger than the default one,
227 which means that the file system cannot extend into the reserved space.
230 The following options override the standard sizes for the disk geometry.
231 Their default values are taken from the disk label.
232 Changing these defaults is useful only when using
234 to build a file system whose raw image will eventually be used on a
235 different type of disk than the one on which it is initially created
236 (for example on a write-once disk).
237 Note that changing any of these values from their defaults will make
240 to find the alternate superblocks if the standard superblock is lost.
241 .Bl -tag -width indent
242 .It Fl S Ar sector-size
243 The size of a sector in bytes (almost never anything but 512).
246 .Dl newfs /dev/ad3s1a
248 Creates a new ufs file system on
252 utility will use a block size of 16384 bytes, a fragment size of 2048 bytes
253 and the largest possible number of blocks per cylinders group.
254 These values tend to produce better performance for most applications
255 than the historical defaults
256 (8192 byte block size and 1024 byte fragment size).
257 This large fragment size may lead to much wasted space
258 on file systems that contain many small files.
277 .%T A Fast File System for UNIX
278 .%J ACM Transactions on Computer Systems 2
282 .%O (reprinted in the BSD System Manager's Manual)