Add Hama WLAN PCI Card 54 Mbps to recognized cards. Bump date.
[netbsd-mini2440.git] / sbin / newfs / newfs.8
blob91688c952c06ad44b8b266825f861202083ef443
1 .\"     $NetBSD: newfs.8,v 1.74 2009/07/01 02:43:34 uwe Exp $
2 .\"
3 .\" Copyright (c) 1983, 1987, 1991, 1993, 1994
4 .\"     The Regents of the University of California.  All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\"    may be used to endorse or promote products derived from this software
16 .\"    without specific prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\"     @(#)newfs.8     8.6 (Berkeley) 5/3/95
31 .\"
32 .Dd December 1, 2009
33 .Dt NEWFS 8
34 .Os
35 .Sh NAME
36 .Nm newfs
37 .Nd construct a new file system
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl FINZ
41 .Op Fl a Ar maxcontig
42 .Op Fl B Ar byte-order
43 .Op Fl b Ar block-size
44 .Op Fl d Ar maxbsize
45 .Op Fl e Ar maxbpg
46 .Op Fl f Ar frag-size
47 .Op Fl g Ar avgfilesize
48 .Op Fl h Ar avgfpdir
49 .Op Fl i Ar bytes-per-inode
50 .Op Fl m Ar free-space
51 .Op Fl n Ar inodes
52 .Op Fl O Ar filesystem-format
53 .Op Fl o Ar optimization
54 .Op Fl S Ar sector-size
55 .Op Fl s Ar size
56 .Op Fl T Ar disk-type
57 .Op Fl v Ar volname
58 .Op Fl V Ar verbose
59 .Ar special
60 .Sh DESCRIPTION
61 .Nm
62 is used to initialize and clear file systems before first use.
63 Before running
64 .Nm
65 the disk must be labeled using
66 .Xr disklabel 8 .
67 .Nm
68 builds a file system on the specified special device
69 basing its defaults on the information in the disk label.
70 Typically the defaults are reasonable, however
71 .Nm
72 has numerous options to allow the defaults to be selectively overridden.
73 .Pp
74 Options with numeric arguments may contain an optional (case-insensitive)
75 suffix:
76 .Bl -tag -width 3n -offset indent -compact
77 .It b
78 Bytes; causes no modification.
79 (Default)
80 .It k
81 Kilo; multiply the argument by 1024
82 .It m
83 Mega; multiply the argument by 1048576
84 .It g
85 Giga; multiply the argument by 1073741824
86 .It t
87 Tera; multiply the argument by 1099511627776
88 .El
89 .Pp
90 The following options define the general layout policies.
91 .Bl -tag -width Fl
92 .It Fl a Ar maxcontig
93 This sets the obsolete maxcontig parameter.
94 .It Fl B Ar byte-order
95 Specify the metadata byte order of the file system to be created.
96 Valid byte orders are
97 .Sq be
98 and
99 .Sq le .
100 If no byte order is specified, the file system is created in host
101 byte order.
102 .It Fl b Ar block-size
103 The block size of the file system, in bytes.
104 It must be a power of two.
105 The smallest allowable size is 4096 bytes.
106 The default size depends upon the size of the file system:
108 .Bl -tag -width "file system size" -compact -offset indent
109 .It Sy "file system size"
110 .Ar block-size
111 .It \*[Lt] 20 MB
112 4 KB
113 .It \*[Lt] 1024 MB
114 8 KB
115 .It \*[Gt]= 1024 MB
116 16 KB
118 .It Fl d Ar maxbsize
119 Set the maximum extent size to
120 .Ar maxbsize .
121 .It Fl e Ar maxbpg
122 This indicates the maximum number of blocks any single file can
123 allocate out of a cylinder group before it is forced to begin
124 allocating blocks from another cylinder group.
125 The default is about one quarter of the total blocks in a cylinder group.
127 .Xr tunefs 8
128 for more details on how to set this option.
129 .It Fl F
130 Create a file system image in
131 .Ar special .
132 The file system size needs to be specified with
133 .Dq Fl s Ar size .
134 No attempts to use or update the disk label will be made.
135 .It Fl f Ar frag-size
136 The fragment size of the file system in bytes.
137 It must be a power of two ranging in value between
138 .Ar block-size Ns /8
140 .Ar block-size .
141 The optimal
142 .Ar block-size : Ns Ar frag-size
143 ratio is 8:1.
144 Other ratios are possible, but are not recommended,
145 and may produce unpredictable results.
146 The default size depends upon the size of the file system:
148 .Bl -tag -width "file system size" -compact -offset indent
149 .It Sy "file system size"
150 .Ar frag-size
151 .It \*[Lt] 20 MB
152 0.5 KB
153 .It \*[Lt] 1024 MB
154 1 KB
155 .It \*[Gt]= 1024 MB
156 2 KB
158 .It Fl g Ar avgfilesize
159 The expected average file size for the file system.
160 .It Fl h Ar avgfpdir
161 The expected average number of files per directory on the file system.
162 .It Fl I
163 Do not require that the file system type listed in the disk label is
164 .Ql 4.2BSD
166 .Ql Apple UFS .
167 .It Fl i Ar bytes-per-inode
168 This specifies the density of inodes in the file system.
169 If fewer inodes are desired, a larger number should be used;
170 to create more inodes a smaller number should be given.
171 The default is to create an inode for every
172 .Pq 4 * Ar frag-size
173 bytes of data space:
175 .Bl -tag -width "file system size" -compact -offset indent
176 .It Sy "file system size"
177 .Ar bytes-per-inode
178 .It \*[Lt] 20 MB
179 2 KB
180 .It \*[Lt] 1024 MB
181 4 KB
182 .It \*[Gt]= 1024 MB
183 8 KB
185 .It Fl m Ar free-space
186 The percentage of space reserved from normal users; the minimum free
187 space threshold.
188 The default value used is 5%.
190 .Xr tunefs 8
191 for more details on how to set this option.
192 .It Fl N
193 Causes the file system parameters to be printed out
194 without really creating the file system.
195 .It Fl n Ar inodes
196 This specifies the number of inodes for the filesystem.
197 If both
198 .Fl i
200 .Fl n
201 are specified then
202 .Fl n
203 takes precedence.
204 .It Fl O Ar filesystem-format
205 Select the filesystem-format
206 .Bl -tag -width 3n -offset indent -compact
207 .It 0
208 4.3BSD; This option is primarily used to build root file systems that can be
209 understood by older boot ROMs.
210 .It 1
211 FFSv1; normal fast-filesystem (default).
212 This is also known as
213 .Sq FFS ,
214 .Sq UFS ,
216 .Sq UFS1 .
217 .It 2
218 FFSv2; enhanced fast-filesystem (suited for more than 1 Terabyte capacity,
219 access control lists).
220 This is also known as
221 .Sq UFS2 .
223 To create an LFS filesystem see
224 .Xr newfs_lfs 8 .
225 To create a Linux Ext2 filesystem see
226 .Xr newfs_ext2fs 8 .
227 .It Fl o Ar optimization
228 Optimization preference; either
229 .Dq space
231 .Dq time .
232 The file system can either be instructed to try to minimize the time spent
233 allocating blocks, or to try to minimize the space fragmentation on the disk.
234 If the value of minfree (see above) is less than 5%,
235 the default is to optimize for space;
236 if the value of minfree is greater than or equal to 5%,
237 the default is to optimize for time.
239 .Xr tunefs 8
240 for more details on how to set this option.
241 .It Fl s Ar size
242 The size of the file system in sectors.
244 .Sq s
245 suffix will be interpreted as the number of sectors (the default).
246 All other suffixes are interpreted as per other numeric arguments,
247 except that the number is converted into sectors by dividing by the
248 sector size (as specified by
249 .Fl S Ar secsize )
250 after suffix interpretation.
252 If no
253 .Fl s Ar size
254 is specified then the filesystem size defaults to that of the partition, or,
256 .Fl F
257 is specified, the existing file.
260 .Ar size
261 is negative the specified size is subtracted from the default size
262 (reserving space at the end of the partition).
263 .It Fl T Ar disk-type
264 Uses information for the specified disk from
265 .Pa /etc/disktab
266 instead of trying to get the information from the disk label.
267 .It Fl v Ar volname
268 This specifies that an Apple UFS filesystem should be created
269 with the given volume name.
270 .It Fl V Ar verbose
271 This controls the amount of information written to stdout:
272 .Bl -tag -width 3n -offset indent -compact
273 .It 0
274 No output
275 .It 1
276 Overall size and cylinder group details.
277 .It 2
278 A progress bar (dots ending at right hand margin).
279 .It 3
280 The first few super-block backup sector numbers are displayed before the
281 progress bar.
282 .It 4
283 All the super-block backup sector numbers are displayed (no progress bar).
285 The default is 3.
287 .Fl N
288 is specifed
290 stops before outputting the progress bar.
291 .It Fl Z
292 Pre-zeros the file system image created with
293 .Fl F .
294 This is necessary if the image is to be used by
295 .Xr vnd 4
296 (which doesn't support file systems with
297 .Sq holes ) .
300 The following option overrides the standard sizes for the disk geometry.
301 The default value is taken from the disk label.
302 Changing this default is useful only when using
304 to build a file system whose raw image will eventually be used on a
305 different type of disk than the one on which it is initially created
306 (for example on a write-once disk).
307 Note that changing this value from its default will make
308 it impossible for
309 .Xr fsck_ffs 8
310 to find the alternative superblocks if the standard superblock is lost.
311 .Bl -tag -width Fl
312 .It Fl S Ar sector-size
313 The size of a sector in bytes (almost never anything but 512).
314 Defaults to 512.
316 .Sh NOTES
317 The file system is created with
318 .Sq random
319 inode generation numbers to improve NFS security.
321 The owner and group ids of the root node of the new file system
322 are set to the effective uid and gid of the user initializing
323 the file system.
325 For the
327 command to succeed,
328 the disk label should first be updated such that the fstype field for the
329 partition is set to
330 .Ql 4.2BSD
332 .Ql Apple UFS ,
333 unless
334 .Fl F
336 .Fl I
337 is used.
339 To create and populate a filesystem image within a file use the
340 .Xr makefs 8
341 utility.
343 The partition size is found using
344 .Xr fstat 2
345 not by inspecting the disklabel.
346 The block size and fragment size will be written back to the disklabel
347 only if the last character of
348 .Ar special
349 references the same partition as the minor device number.
351 Unless
352 .Fl F
353 is specified,
354 .Ar special
355 must be a raw device.
356 This means that for example
357 .Pa wd0a
359 .Pa /dev/rwd0a
360 must be specified instead of
361 .Pa /dev/wd0a .
362 .Sh SEE ALSO
363 .Xr fstat 2 ,
364 .Xr disktab 5 ,
365 .Xr fs 5 ,
366 .Xr disklabel 8 ,
367 .Xr diskpart 8 ,
368 .Xr dumpfs 8 ,
369 .\" .Xr format 8 ,
370 .Xr fsck_ffs 8 ,
371 .\" .Xr fsirand 8 ,
372 .Xr makefs 8 ,
373 .Xr mount 8 ,
374 .Xr mount_mfs 8 ,
375 .Xr newfs_ext2fs 8 ,
376 .Xr newfs_lfs 8 ,
377 .Xr newfs_msdos 8 ,
378 .Xr tunefs 8
380 .%A M. McKusick
381 .%A W. Joy
382 .%A S. Leffler
383 .%A R. Fabry
384 .%T A Fast File System for UNIX ,
385 .%J ACM Transactions on Computer Systems 2
386 .%V 3
387 .%P pp 181-197
388 .%D August 1984
389 .%O (reprinted in the BSD System Manager's Manual)
392 .%A M. McKusick
393 .%T Enhancements to the fast filesystem to support multi-terabyte storage systems
394 .%J Proceedings of the BSD Conference 2003
395 .%P pp 79-90
396 .%D September 2003
398 .Sh HISTORY
401 command appeared in
402 .Bx 4.2 .