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 .\" 3. 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 k Ar held-for-metadata-blocks
54 .Op Fl m Ar free-space
55 .Op Fl o Ar optimization
63 utility is used to initialize and clear file systems before first use.
66 utility builds a file system on the specified special file.
67 (We often refer to the
71 although the special file need not be a physical disk.
72 In fact, it need not even be special.)
73 Typically the defaults are reasonable, however
75 has numerous options to allow the defaults to be selectively overridden.
77 The following options define the general layout policies:
78 .Bl -tag -width indent
80 Erase the content of the disk before making the filesystem.
81 The reserved area in front of the superblock (for bootcode) will not be erased.
82 Erasing is only relevant to flash-memory or thinly provisioned devices.
83 Erasing may take a long time.
84 If the device does not support BIO_DELETE, the command will fail.
86 Enable journaling on the new file system via gjournal.
91 Add a volume label to the new file system.
93 Cause the file system parameters to be printed out
94 without really creating the file system.
95 .It Fl O Ar filesystem-type
96 Use 1 to specify that a UFS1 format file system be built;
97 use 2 to specify that a UFS2 format file system be built.
98 The default format is UFS2.
100 For backward compatibility.
102 Enable soft updates on the new file system.
103 .It Fl a Ar maxcontig
104 Specify the maximum number of contiguous blocks that will be
105 laid out before forcing a rotational delay.
106 The default value is 16.
109 for more details on how to set this option.
110 .It Fl b Ar block-size
111 The block size of the file system, in bytes.
112 It must be a power of 2.
114 default size is 32768 bytes, and the smallest allowable size is 4096 bytes.
115 The optimal block:fragment ratio is 8:1.
116 Other ratios are possible, but are not recommended,
117 and may produce poor results.
118 .It Fl c Ar blocks-per-cylinder-group
119 The number of blocks per cylinder group in a file system.
120 The default is to compute the maximum allowed by the other parameters.
122 dependent on a number of other parameters, in particular the block size
123 and the number of bytes per inode.
124 .It Fl d Ar max-extent-size
125 The file system may choose to store large files using extents.
126 This parameter specifies the largest extent size that may be used.
127 The default value is the file system blocksize.
128 It is presently limited to a maximum value of 16 times the
129 file system blocksize and a minimum value of the file system blocksize.
131 Indicate the maximum number of blocks any single file can
132 allocate out of a cylinder group before it is forced to begin
133 allocating blocks from another cylinder group.
134 The default is about one quarter of the total blocks in a cylinder group.
137 for more details on how to set this option.
138 .It Fl f Ar frag-size
139 The fragment size of the file system in bytes.
140 It must be a power of two
141 ranging in value between
145 The default is 4096 bytes.
146 .It Fl g Ar avgfilesize
147 The expected average file size for the file system.
149 The expected average number of files per directory on the file system.
151 Specify the density of inodes in the file system.
152 The default is to create an inode for every
155 If fewer inodes are desired, a larger number should be used;
156 to create more inodes a smaller number should be given.
157 One inode is required for each distinct file, so this value effectively
158 specifies the average file size on the file system.
160 Enable soft updates journaling on the new file system.
161 This flag is implemented by running the
163 utility found in the user's
165 .It Fl k Ar held-for-metadata-blocks
166 Set the amount of space to be held for metadata blocks in each cylinder group.
167 When set, the file system preference routines will try to save
168 the specified amount of space immediately following the inode blocks
169 in each cylinder group for use by metadata blocks.
170 Clustering the metadata blocks speeds up random file access
171 and decreases the running time of
175 sets it to half of the space reserved to minfree.
177 Enable multilabel MAC on the new file system.
178 .It Fl m Ar free-space
179 The percentage of space reserved from normal users; the minimum free
181 The default value used is
189 for more details on how to set this option.
193 directory on the new file system.
194 The resulting file system will not support snapshot generation, so
196 in live mode and background
198 will not function properly.
203 will work on the file system.
204 This option is intended primarily for memory or vnode-backed file systems that
210 .It Fl o Ar optimization
214 The file system can either be instructed to try to minimize the time spent
215 allocating blocks, or to try to minimize the space fragmentation on the disk.
216 If the value of minfree (see above) is less than 8%,
217 the default is to optimize for
219 if the value of minfree is greater than or equal to 8%,
220 the default is to optimize for
224 for more details on how to set this option.
225 .It Fl p Ar partition
226 The partition name (a..h) you want to use in case the underlying image
227 is a file, so you do not have access to individual partitions through the
229 Can also be used with a device, e.g.,
237 The size, in sectors, of reserved space
238 at the end of the partition specified in
240 This space will not be occupied by the file system;
241 it can be used by other consumers such as
245 The size of the file system in sectors.
246 This value defaults to the size of the
247 raw partition specified in
251 space at its end (see
255 of 0 can also be used to choose the default value.
258 value cannot be larger than the default one,
259 which means that the file system cannot extend into the reserved space.
261 Turn on the TRIM enable flag.
262 If enabled, and if the underlying device supports the BIO_DELETE
263 command, the file system will send a delete request to the underlying
264 device for each freed block.
265 The trim enable flag is typically set for flash-memory devices to
266 reduce write amplification which reduces wear on write-limited
267 flash-memory and often improves long-term performance.
268 Thinly provisioned storage also benefits by returning unused blocks to
272 The following options override the standard sizes for the disk geometry.
273 Their default values are taken from the disk label.
274 Changing these defaults is useful only when using
276 to build a file system whose raw image will eventually be used on a
277 different type of disk than the one on which it is initially created
278 (for example on a write-once disk).
279 Note that changing any of these values from their defaults will make
282 to find the alternate superblocks if the standard superblock is lost.
283 .Bl -tag -width indent
284 .It Fl S Ar sector-size
285 The size of a sector in bytes (almost never anything but 512).
288 .Dl newfs /dev/ada3s1a
290 Creates a new ufs file system on
294 utility will use a block size of 32768 bytes, a fragment size of 4096 bytes
295 and the largest possible number of blocks per cylinders group.
296 These values tend to produce better performance for most applications
297 than the historical defaults
298 (8192 byte block size and 1024 byte fragment size).
299 This large fragment size may lead to much wasted space
300 on file systems that contain many small files.
322 .%T A Fast File System for UNIX
323 .%J ACM Transactions on Computer Systems 2
327 .%O (reprinted in the BSD System Manager's Manual)