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