Remove advertising header from man pages.
[dragonfly.git] / sbin / newfs / newfs.8
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 .\" 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.
15 .\"
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
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)newfs.8     8.6 (Berkeley) 5/3/95
29 .\" $FreeBSD: src/sbin/newfs/newfs.8,v 1.26.2.15 2003/05/13 12:16:08 joerg Exp $
30 .\"
31 .Dd October 7, 2011
32 .Dt NEWFS 8
33 .Os
34 .Sh NAME
35 .Nm newfs ,
36 .Nm mount_mfs
37 .Nd construct a new UFS file system
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl L Ar volname
41 .Op Fl NCEOU
42 .Op Fl S Ar sector-size
43 .Op Fl T Ar disktype
44 .Op Fl a Ar maxcontig
45 .Op Fl b Ar block-size
46 .Op Fl c Ar cylinders
47 .Op Fl d Ar rotdelay
48 .Op Fl e Ar maxbpg
49 .Op Fl f Ar frag-size
50 .Op Fl g Ar avgfilesize
51 .Op Fl h Ar avfpdir
52 .Op Fl i Ar bytes
53 .Op Fl k Ar skew
54 .Op Fl l Ar interleave
55 .Op Fl m Ar free space
56 .Op Fl n Ar rotational positions
57 .Op Fl o Ar optimization
58 .Op Fl p Ar sectors
59 .Op Fl r Ar revolutions
60 .Op Fl s Ar size
61 .Op Fl t Ar tracks
62 .Op Fl u Ar sectors
63 .Op Fl v
64 .Op Fl x Ar sectors
65 .Ar special
66 .Nm mount_mfs
67 .Op Fl NU
68 .Op Fl F Ar file
69 .Op Fl T Ar disktype
70 .Op Fl a Ar maxcontig
71 .Op Fl b Ar block-size
72 .Op Fl c Ar cylinders
73 .Op Fl d Ar rotdelay
74 .Op Fl e Ar maxbpg
75 .Op Fl f Ar frag-size
76 .Op Fl i Ar bytes
77 .Op Fl m Ar free space
78 .Op Fl n Ar rotational positions
79 .Op Fl o Ar options
80 .Op Fl s Ar size
81 .Op Fl v
82 .Ar special node
83 .Sh DESCRIPTION
84 .Nm Newfs
85 is used to initialize and clear filesystems before first use.
86 Before running
87 .Nm
88 or
89 .Nm mount_mfs ,
90 the disk must be labeled using
91 .Xr disklabel 8 .
92 .Nm Newfs
93 builds a file system on the specified special file.
94 (We often refer to the
95 .Dq special file
96 as the
97 .Dq disk ,
98 although the special file need not be a physical disk.
99 In fact, it need not even be special.)
100 Typically the defaults are reasonable, however
101 .Nm
102 has numerous options to allow the defaults to be selectively overridden.
103 .Pp
104 .Nm Mount_mfs
105 is used to build a file system in virtual memory and then mount it
106 on a specified node.
107 .Nm Mount_mfs
108 exits and the contents of the file system are lost
109 when the file system is unmounted.
110 If
111 .Nm mount_mfs
112 is sent a signal while running,
113 for example during system shutdown,
114 it will attempt to unmount its
115 corresponding file system.
116 The parameters to
117 .Nm mount_mfs
118 are the same as those to
119 .Nm .
120 If the
121 .Fl T
122 flag is specified (see below), the special file is unused.
123 Otherwise, it is only used to read the disk label which provides
124 a set of configuration parameters for the memory based file system.
125 The special file is typically that of the primary swap area,
126 since that is where the file system will be backed up when
127 free memory gets low and the memory supporting
128 the file system has to be paged.
129 .Pp
130 .Nm mount_mfs
131 creates the raw character device
132 .Pa /dev/mfs<PID>
133 to represent the backing store while the mount is active.  This device may
134 be read but not written and allows swap-based MFS filesystems to be dumped
135 if desired.
136 .Pp
137 The following options define the general layout policies:
138 .Bl -tag -width indent
139 .It Fl T Ar disktype
140 For backward compatibility and for
141 .Nm mount_mfs .
142 .It Fl E
143 Use TRIM to erase the device's data before creating the file system.
144 The underlying device must have the TRIM sysctl enabled.
145 Only devices that support TRIM will have such a sysctl option
146 .Va ( kern.cam.da.X.trim_enabled ) .
147 .It Fl F Ar file
148 .Nm Mount_mfs
149 will use this file for the image of the filesystem.  When
150 .Nm mount_mfs
151 exits, this file will be left behind.
152 .It Fl C
153 Tell
154 .Nm Mount_mfs
155 to copy the underlying filesystem into the MFS mount being created
156 over it.
157 .It Fl L Ar volname
158 Add a volume label to the new file system.
159 .It Fl N
160 Cause the file system parameters to be printed out
161 without really creating the file system.
162 .It Fl O
163 Create a
164 .Bx 4.3
165 format filesystem.
166 This options is primarily used to build root filesystems
167 that can be understood by older boot ROMs.
168 .It Fl T
169 Use information for the specified disk from
170 .Pa /etc/disktab
171 instead of trying to get geometry information from the
172 storage device.
173 .It Fl U
174 Enables soft updates on the new filesystem.
175 .It Fl a Ar maxcontig
176 Specify the maximum number of contiguous blocks that will be
177 laid out before forcing a rotational delay (see the
178 .Fl d
179 option).
180 The default value is 1.
181 See
182 .Xr tunefs 8
183 for more details on how to set this option.
184 .It Fl b Ar block-size
185 The block size of the file system, in bytes.  It must be a power of 2.  The
186 default size is 16384 bytes, and the smallest allowable size is 4096 bytes.
187 The optimal block:fragment ratio is 8:1.
188 Other ratios are possible, but are not recommended,
189 and may produce unpredictable results.
190 .It Fl c Ar #cylinders/group
191 The number of cylinders per cylinder group in a file system.  The default
192 is to compute the maximum allowed by the other parameters.  This value is
193 dependent on a number of other parameters, in particular the block size
194 and the number of bytes per inode.
195 .It Fl d Ar rotdelay
196 This parameter once specified the minimum time in milliseconds required to
197 initiate another disk transfer on the same cylinder.  It was used in determining
198 the rotationally optimal layout for disk blocks within a file.  Modern disks
199 with read/write-behind achieve higher performance with this feature disabled, so
200 this value should be left at the default value of 0 milliseconds.  See
201 .Xr tunefs 8
202 for more details on how to set this option.
203 .It Fl e Ar maxbpg
204 Indicate the maximum number of blocks any single file can
205 allocate out of a cylinder group before it is forced to begin
206 allocating blocks from another cylinder group.
207 The default is about one quarter of the total blocks in a cylinder group.
208 See
209 .Xr tunefs 8
210 for more details on how to set this option.
211 .It Fl f Ar frag-size
212 The fragment size of the file system in bytes.  It must be a power of two
213 ranging in value between
214 .Ar blocksize Ns /8
215 and
216 .Ar blocksize .
217 The default is 2048 bytes.
218 .It Fl g Ar avgfilesize
219 The expected average file size for the file system.
220 .It Fl h Ar avgfpdir
221 The expected average number of files per directory on the file system.
222 .It Fl i Ar number of bytes per inode
223 Specify the density of inodes in the file system.
224 The default is to create an inode for every
225 .Pq 4 * Ar frag-size
226 bytes of data space.
227 If fewer inodes are desired, a larger number should be used;
228 to create more inodes a smaller number should be given.
229 One inode is required for each distinct file, so this value effectively
230 specifies the average file size on the file system.
231 .It Fl m Ar free space \&%
232 The percentage of space reserved from normal users; the minimum free
233 space threshold.
234 The default value used is
235 defined by
236 .Dv MINFREE
237 from
238 .In ufs/ffs/fs.h ,
239 currently 8%.
240 See
241 .Xr tunefs 8
242 for more details on how to set this option.
243 .It Fl n Ar number of distinguished rotational positions
244 .Xr UFS 5
245 has the ability to keep track of the availability of blocks at different
246 rotational positions, so that it could lay out the data to be picked up with
247 minimum rotational latency.  This parameter specifies the default number of
248 rotational positions to distinguish.
249 .Pp
250 Nowadays this value should be set to 1 (which essentially disables the
251 rotational position table) because modern drives with read-ahead and
252 write-behind do better without the rotational position table.
253 .It Fl o Ar optimization\ preference
254 .Pq Cm space No or Cm time .
255 The file system can either be instructed to try to minimize the time spent
256 allocating blocks, or to try to minimize the space fragmentation on the disk.
257 If the value of minfree (see above) is less than 8%,
258 the default is to optimize for
259 .Cm space ;
260 if the value of minfree is greater than or equal to 8%,
261 the default is to optimize for
262 .Cm time .
263 See
264 .Xr tunefs 8
265 for more details on how to set this option.
266 .It Fl s Ar size
267 The size of the file system in sectors.  This value defaults to the size of the
268 raw partition specified in
269 .Ar special
270 (in other words,
271 .Nm
272 will use the entire partition for the file system).
273 .It Fl v
274 Specify that the disk does not contain any partitions, and that
275 .Nm
276 should build a file system on the whole disk.
277 This option is useful for synthetic disks such as
278 .Nm vinum .
279 It may also be used to allow
280 .Nm
281 to operate on regular files.
282 When operating on a regular file,
283 .Nm
284 will synthesize a reasonable geometry for the filesystem.
285 .El
286 .Pp
287 The following options override the standard sizes for the disk geometry.
288 Their default values are taken from the disk label.
289 Changing these defaults is useful only when using
290 .Nm
291 to build a file system whose raw image will eventually be used on a
292 different type of disk than the one on which it is initially created
293 (for example on a write-once disk).
294 Note that changing any of these values from their defaults will make
295 it impossible for
296 .Xr fsck 8
297 to find the alternate superblocks if the standard superblock is lost.
298 .Bl -tag -width indent
299 .It Fl S Ar sector-size
300 The size of a sector in bytes (almost never anything but 512).
301 .It Fl k Ar sector \&0 skew , per track
302 Used to describe perturbations in the media format to compensate for
303 a slow controller.
304 Track skew is the offset of sector 0 on track N relative to sector 0
305 on track N-1 on the same cylinder.
306 This option is of historical importance only; modern controllers are always fast
307 enough to handle operations back-to-back.
308 .It Fl l Ar hardware sector interleave
309 Used to describe perturbations in the media format to compensate for
310 a slow controller.
311 Interleave is physical sector interleave on each track,
312 specified as the denominator of the ratio:
313 .Dl sectors read/sectors passed over
314 Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies
315 logical sector 0 is separated by one sector from logical sector 1.
316 This option is of historical importance only; the physical sector layout of
317 modern disks is not visible from outside.
318 .It Fl p Ar spare sectors per track
319 Spare sectors (bad sector replacements) are physical sectors that occupy
320 space at the end of each track.
321 They are not counted as part of the sectors/track
322 .Pq Fl u
323 since they are not available to the file system for data allocation.
324 This option is of historical importance only.  Modern disks perform their own
325 bad sector allocation.
326 .It Fl r Ar revolutions/minute
327 The speed of the disk in revolutions per minute.  This value is no longer of
328 interest, since all the parameters which depend on it are usually disabled.
329 .It Fl t Ar #tracks/cylinder
330 The number of tracks/cylinder available for data allocation by the file
331 system.
332 The default is 1.
333 If zero is specified, the value from the device geometry will be used.
334 .It Fl u Ar sectors/track
335 The number of sectors per track available for data allocation by the file
336 system.
337 The default is 4096.
338 If zero is specified, the value from the device geometry will be used.
339 This does not include sectors reserved at the end of each track for bad
340 block replacement (see the
341 .Fl p
342 option).
343 .It Fl x Ar spare sectors per cylinder
344 Spare sectors (bad sector replacements) are physical sectors that occupy
345 space at the end of the last track in the cylinder.
346 They are deducted from the sectors/track
347 .Pq Fl u
348 of the last track of each cylinder since they are not available to the file
349 system for data allocation.
350 This option is of historical importance only.  Modern disks perform their own
351 bad sector allocation.
352 .El
353 .Pp
354 The options to the
355 .Nm mount_mfs
356 command are as described for the
357 .Nm
358 command, except for the
359 .Fl o
360 option.
361 .Pp
362 That option is as follows:
363 .Bl -tag -width indent
364 .It Fl o
365 Options are specified with a
366 .Fl o
367 flag followed by a comma separated string of options.
368 See the
369 .Xr mount 8
370 man page for possible options and their meanings.
371 .El
372 .Sh EXAMPLES
373 .Dl newfs /dev/ad3s1a
374 .Pp
375 Creates a new
376 .Xr UFS 5
377 file system on
378 .Pa ad3s1a .
379 .Nm
380 will use a block size of 16384 bytes, a fragment size of 2048 bytes
381 and the largest possible number of cylinders per group.
382 These values tend to produce better performance for most applications
383 than the historical defaults
384 (8192 byte block size and 1024 byte fragment size).
385 This large fragment size
386 may lead to large amounts of wasted space
387 on filesystems that contain a large number of small files.
388 .Pp
389 .Dl mount_mfs -s 131072 -o nosuid,nodev,nosymfollow /dev/da0s1b /tmp
390 .Pp
391 Mount a 64 MB large memory file system on
392 .Pa /tmp ,
393 with
394 .Xr mount 8
395 options
396 .Cm nosuid ,
397 .Cm nodev ,
398 and
399 .Cm nosymfollow .
400 .Sh SEE ALSO
401 .Xr fdformat 1 ,
402 .Xr disktab 5 ,
403 .Xr fs 5 ,
404 .Xr UFS 5 ,
405 .Xr camcontrol 8 ,
406 .Xr disklabel 8 ,
407 .Xr dumpfs 8 ,
408 .Xr fsck 8 ,
409 .Xr mount 8 ,
410 .Xr tunefs 8 ,
411 .Xr vinum 8
412 .Rs
413 .%A M. McKusick
414 .%A W. Joy
415 .%A S. Leffler
416 .%A R. Fabry
417 .%T A Fast File System for UNIX
418 .%J ACM Transactions on Computer Systems 2
419 .%V 3
420 .%P pp 181-197
421 .%D August 1984
422 .%O (reprinted in the BSD System Manager's Manual)
423 .Re
424 .Sh HISTORY
425 The
426 .Nm
427 command appeared in
428 .Bx 4.2 .