xref: /freebsd/sbin/newfs/newfs.8 (revision 380a989b3223d455375b4fae70fd0b9bdd43bafb)
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.\"	$Id: newfs.8,v 1.19 1998/11/28 09:59:40 rnordier Exp $
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
85replaces the more obtuse
86.Xr mkfs 8
87program.
88Before running
89.Nm
90or
91.Nm mount_mfs ,
92the disk must be labeled using
93.Xr disklabel 8 .
94.Nm Newfs
95builds a file system on the specified special file.
96(We often refer to the
97.Dq special file
98as the
99.Dq disk ,
100although the special file need not be a physical disk.
101In fact, it need not even be special.)
102Typically the defaults are reasonable, however
103.Nm
104has numerous options to allow the defaults to be selectively overridden.
105.Pp
106.Nm Mount_mfs
107is used to build a file system in virtual memory and then mount it
108on a specified node.
109.Nm Mount_mfs
110exits and the contents of the file system are lost
111when the file system is unmounted.
112If
113.Nm mount_mfs
114is sent a signal while running,
115for example during system shutdown,
116it will attempt to unmount its
117corresponding file system.
118The parameters to
119.Nm mount_mfs
120are the same as those to
121.Nm Ns .
122If the
123.Fl T
124flag is specified (see below), the special file is unused.
125Otherwise, it is only used to read the disk label which provides
126a set of configuration parameters for the memory based file system.
127The special file is typically that of the primary swap area,
128since that is where the file system will be backed up when
129free memory gets low and the memory supporting
130the file system has to be paged.
131.Pp
132The following options define the general layout policies:
133.Bl -tag -width indent
134.It Fl T Ar disktype
135For backward compatibility and for
136.Nm mount_mfs .
137.It Fl F Ar file
138.Nm Mount_mfs
139will use this file for the image of the filesystem.  When
140.Nm mount_mfs
141exits, this file will be left behind.
142.It Fl N
143Cause the file system parameters to be printed out
144without really creating the file system.
145.It Fl O
146Create a
147.Bx 4.3
148format filesystem.
149This options is primarily used to build root filesystems
150that can be understood by older boot ROMs.
151.It Fl T
152Use information for the specified disk from
153.Pa /etc/disktab
154instead of trying to get the information from a disklabel.
155.It Fl a Ar maxcontig
156Specify the maximum number of contiguous blocks that will be
157laid out before forcing a rotational delay (see the
158.Fl d
159option).
160The default value is 1.
161See
162.Xr tunefs 8
163for more details on how to set this option.
164.It Fl b Ar block-size
165The block size of the file system, in bytes.
166.It Fl c Ar #cylinders/group
167The number of cylinders per cylinder group in a file system.
168The default value is 16.
169.It Fl d Ar rotdelay
170Specify the expected time (in milliseconds) to service a transfer
171completion interrupt and initiate a new transfer on the same disk.
172The default is 0 milliseconds.
173See
174.Xr tunefs 8
175for more details on how to set this option.
176.ne 1i
177.It Fl e Ar maxbpg
178Indicate the maximum number of blocks any single file can
179allocate out of a cylinder group before it is forced to begin
180allocating blocks from another cylinder group.
181The default is about one quarter of the total blocks in a cylinder group.
182See
183.Xr tunefs 8
184for more details on how to set this option.
185.It Fl f Ar frag-size
186The fragment size of the file system in bytes.
187The default is 1024 bytes.
188.It Fl i Ar number of bytes per inode
189Specify the density of inodes in the file system.
190The default is to create an inode for every (4 * frag-size) bytes of data space.
191If fewer inodes are desired, a larger number should be used;
192to create more inodes a smaller number should be given.
193.It Fl m Ar free space \&%
194The percentage of space reserved from normal users; the minimum free
195space threshold.
196The default value used is
197defined by
198.Dv MINFREE
199from
200.Ao Pa ufs/ffs/fs.h Ac ,
201currently 8%.
202See
203.Xr tunefs 8
204for more details on how to set this option.
205.It Fl n Ar number of distinguished rotational positions
206Determine how many rotational time slots there are in one revolution of
207the disk. Defaults to 1, which essentially disables the rotational position
208table.
209.It Fl o Ar optimization\ preference
210.Pq ``space'' or ``time''
211The file system can either be instructed to try to minimize the time spent
212allocating blocks, or to try to minimize the space fragmentation on the disk.
213If the value of minfree (see above) is less than 8%,
214the default is to optimize for space;
215if the value of minfree is greater than or equal to 8%,
216the default is to optimize for time.
217See
218.Xr tunefs 8
219for more details on how to set this option.
220.It Fl s Ar size
221The size of the file system in sectors.
222.It Fl v
223Specify that the disk does not contain any partitions, and that
224.Nm
225should build a file system on the whole disk.
226This option is useful for synthetic disks such as
227.Nm vinum.
228.El
229.Pp
230The following options override the standard sizes for the disk geometry.
231Their default values are taken from the disk label.
232Changing these defaults is useful only when using
233.Nm
234to build a file system whose raw image will eventually be used on a
235different type of disk than the one on which it is initially created
236(for example on a write-once disk).
237Note that changing any of these values from their defaults will make
238it impossible for
239.Xr fsck 8
240to find the alternate superblocks if the standard superblock is lost.
241.Bl -tag -width indent
242.It Fl S Ar sector-size
243The size of a sector in bytes (almost never anything but 512).
244.It Fl k Ar sector \&0 skew , per track
245Used to describe perturbations in the media format to compensate for
246a slow controller.
247Track skew is the offset of sector 0 on track N relative to sector 0
248on track N-1 on the same cylinder.
249.It Fl l Ar hardware sector interleave
250Used to describe perturbations in the media format to compensate for
251a slow controller.
252Interleave is physical sector interleave on each track,
253specified as the denominator of the ratio:
254.Dl sectors read/sectors passed over
255Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies
256logical sector 0 is separated by one sector from logical sector 1.
257.It Fl p Ar spare sectors per track
258Spare sectors (bad sector replacements) are physical sectors that occupy
259space at the end of each track.
260They are not counted as part of the sectors/track
261.Pq Fl u
262since they are not available to the file system for data allocation.
263.It Fl r Ar revolutions/minute
264The speed of the disk in revolutions per minute.
265.ne 1i
266.It Fl t Ar #tracks/cylinder
267The number of tracks/cylinder available for data allocation by the file
268system.
269The default is 1.
270If zero is specified, the value from the disklabel will be used.
271.It Fl u Ar sectors/track
272The number of sectors per track available for data allocation by the file
273system.
274The default is 4096.
275If zero is specified, the value from the disklabel will be used.
276This does not include sectors reserved at the end of each track for bad
277block replacement (see the
278.Fl p
279option).
280.It Fl x Ar spare sectors per cylinder
281Spare sectors (bad sector replacements) are physical sectors that occupy
282space at the end of the last track in the cylinder.
283They are deducted from the sectors/track
284.Pq Fl u
285of the last track of each cylinder since they are not available to the file
286system for data allocation.
287.El
288.Pp
289The options to the
290.Nm mount_mfs
291command are as described for the
292.Nm
293command, except for the
294.Fl o
295option.
296.Pp
297That option is as follows:
298.Bl -tag -width indent
299.It Fl o
300Options are specified with a
301.Fl o
302flag followed by a comma separated string of options.
303See the
304.Xr mount 8
305man page for possible options and their meanings.
306.El
307.Sh EXAMPLES
308.Pp
309.Dl mount_mfs -s 131072 -o nosuid,nodev /dev/da0s1b /tmp
310.Pp
311Mount a 64 MB large memory file system on /tmp, with
312.Xr mount 8
313options nosuid and nodev.
314.Sh BUGS
315The boot code of
316.Bx Free
317assumes that the file system that carries the
318kernel has blocks of 8 kilobytes and fragments of 1 kilobyte. You will
319not be able to boot from a file system that uses another size.
320.Sh SEE ALSO
321.Xr fdformat 1 ,
322.Xr disktab 5 ,
323.Xr fs 5 ,
324.Xr disklabel 8 ,
325.Xr diskpart 8 ,
326.Xr dumpfs 8 ,
327.Xr fsck 8 ,
328.Xr mount 8 ,
329.Xr scsiformat 8 ,
330.Xr tunefs 8 ,
331.Xr vinum 8
332.Rs
333.%A M. McKusick
334.%A W. Joy
335.%A S. Leffler
336.%A R. Fabry
337.%T A Fast File System for UNIX ,
338.%J ACM Transactions on Computer Systems 2
339.%V 3
340.%P pp 181-197
341.%D August 1984
342.%O (reprinted in the BSD System Manager's Manual)
343.Re
344.Sh HISTORY
345The
346.Nm
347command appeared in
348.Bx 4.2 .
349