xref: /freebsd/sbin/newfs/newfs.8 (revision afe61c15161c324a7af299a9b8457aba5afc92db)
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.3 (Berkeley) 3/27/94
33.\"
34.Dd March 27, 1994
35.Dt NEWFS 8
36.Os BSD 4.2
37.Sh NAME
38.Nm newfs ,
39.Nm mfs
40.Nd construct a new file system
41.Sh SYNOPSIS
42.Nm newfs
43.Op Fl NO
44.Op Fl S Ar sector-size
45.Op Fl a maxcontig
46.Op Fl b Ar block-size
47.Op Fl c Ar cylinders
48.Op Fl d Ar rotdelay
49.Op Fl e Ar maxbpg
50.Op Fl f Ar frag-size
51.Op Fl i Ar bytes
52.Op Fl k Ar skew
53.Op Fl l Ar interleave
54.Op Fl m Ar free space
55.Op Fl o Ar optimization
56.Op Fl p Ar sectors
57.Op Fl r Ar revolutions
58.Op Fl s Ar size
59.Op Fl t Ar tracks
60.Op Fl u Ar sectors
61.Op Fl x Ar sectors
62.Ar special
63.Nm mount_mfs
64.Op Fl N
65.Op Fl a maxcontig
66.Op Fl b Ar block-size
67.Op Fl c Ar cylinders
68.Op Fl d Ar rotdelay
69.Op Fl e Ar maxbpg
70.Op Fl f Ar frag-size
71.Op Fl i Ar bytes
72.Op Fl m Ar free space
73.Op Fl o Ar options
74.Op Fl s Ar size
75.Ar special node
76.Sh DESCRIPTION
77.Nm Newfs
78replaces the more obtuse
79.Xr mkfs 8
80program.
81Before running
82.Nm newfs
83or
84.Nm mount_mfs ,
85the disk must be labeled using
86.Xr disklabel 8 .
87.Nm Newfs
88builds a file system on the specified special device
89basing its defaults on the information in the disk label.
90Typically the defaults are reasonable, however
91.Nm newfs
92has numerous options to allow the defaults to be selectively overridden.
93.Pp
94.Nm Mount_mfs
95is used to build a file system in virtual memory and then mount it
96on a specified node.
97.Nm Mount_mfs
98exits and the contents of the file system are lost
99when the file system is unmounted.
100If
101.Nm mount_mfs
102is sent a signal while running,
103for example during system shutdown,
104it will attempt to unmount its
105corresponding file system.
106The parameters to
107.Nm mount_mfs
108are the same as those to
109.Nm newfs .
110The special file is only used to read the disk label which provides
111a set of configuration parameters for the memory based file system.
112The special file is typically that of the primary swap area,
113since that is where the file system will be backed up when
114free memory gets low and the memory supporting
115the file system has to be paged.
116.Pp
117The following options define the general layout policies.
118.Bl -tag -width Fl
119.It Fl N
120Causes the file system parameters to be printed out
121without really creating the file system.
122.It Fl O
123Creates a 4.3BSD format filesystem.
124This options is primarily used to build root filesystems
125that can be understood by older boot ROMs.
126.It Fl a Ar maxcontig
127This specifies the maximum number of contiguous blocks that will be
128laid out before forcing a rotational delay (see the
129.Fl d
130option).
131The default value is one.
132See
133.Xr tunefs 8
134for more details on how to set this option.
135.It Fl b Ar block-size
136The block size of the file system, in bytes.
137.It Fl c Ar #cylinders/group
138The number of cylinders per cylinder group in a file system.
139The default value is 16.
140.It Fl d Ar rotdelay
141This specifies the expected time (in milliseconds) to service a transfer
142completion interrupt and initiate a new transfer on the same disk.
143The default is 4 milliseconds.
144See
145.Xr tunefs 8
146for more details on how to set this option.
147.It Fl e Ar maxbpg
148This indicates the maximum number of blocks any single file can
149allocate out of a cylinder group before it is forced to begin
150allocating blocks from another cylinder group.
151The default is about one quarter of the total blocks in a cylinder group.
152See
153.Xr tunefs 8
154for more details on how to set this option.
155.It Fl f Ar frag-size
156The fragment size of the file system in bytes.
157.It Fl i Ar number of bytes per inode
158This specifies the density of inodes in the file system.
159The default is to create an inode for each 2048 bytes of data space.
160If fewer inodes are desired, a larger number should be used;
161to create more inodes a smaller number should be given.
162.It Fl m Ar free space \&%
163The percentage of space reserved from normal users; the minimum free
164space threshold.
165The default value used is 10%.
166See
167.Xr tunefs 8
168for more details on how to set this option.
169.It Fl o Ar optimization\ preference
170.Pq ``space'' or ``time''
171The file system can either be instructed to try to minimize the time spent
172allocating blocks, or to try to minimize the space fragmentation on the disk.
173If the value of minfree (see above) is less than 10%,
174the default is to optimize for space;
175if the value of minfree is greater than or equal to 10%,
176the default is to optimize for time.
177See
178.Xr tunefs 8
179for more details on how to set this option.
180.It Fl s Ar size
181The size of the file system in sectors.
182.El
183.Pp
184The following options override the standard sizes for the disk geometry.
185Their default values are taken from the disk label.
186Changing these defaults is useful only when using
187.Nm newfs
188to build a file system whose raw image will eventually be used on a
189different type of disk than the one on which it is initially created
190(for example on a write-once disk).
191Note that changing any of these values from their defaults will make
192it impossible for
193.Xr fsck
194to find the alternate superblocks if the standard superblock is lost.
195.Bl -tag -width Fl
196.It Fl S Ar sector-size
197The size of a sector in bytes (almost never anything but 512).
198.It Fl k Ar sector \&0 skew , per track
199Used to describe perturbations in the media format to compensate for
200a slow controller.
201Track skew is the offset of sector 0 on track N relative to sector 0
202on track N-1 on the same cylinder.
203.It Fl l Ar hardware sector interleave
204Used to describe perturbations in the media format to compensate for
205a slow controller.
206Interleave is physical sector interleave on each track,
207specified as the denominator of the ratio:
208.Dl sectors read/sectors passed over
209Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies
210logical sector 0 is separated by one sector from logical sector 1.
211.It Fl p Ar spare sectors per track
212Spare sectors (bad sector replacements) are physical sectors that occupy
213space at the end of each track.
214They are not counted as part of the sectors/track
215.Pq Fl u
216since they are not available to the file system for data allocation.
217.It Fl r Ar revolutions/minute
218The speed of the disk in revolutions per minute.
219.It Fl t Ar #tracks/cylinder
220The number of tracks/cylinder available for data allocation by the file
221system.
222.It Fl u Ar sectors/track
223The number of sectors per track available for data allocation by the file
224system.
225This does not include sectors reserved at the end of each track for bad
226block replacement (see the
227.Fl p
228option.)
229.It Fl x Ar spare sectors per cylinder
230Spare sectors (bad sector replacements) are physical sectors that occupy
231space at the end of the last track in the cylinder.
232They are deducted from the sectors/track
233.Pq Fl u
234of the last track of each cylinder since they are not available to the file
235system for data allocation.
236.El
237.Pp
238The options to the
239.Nm mount_mfs
240command are as described for the
241.Nm newfs
242command, except for the
243.Fl o
244option.
245.Pp
246That option is as follows:
247.Bl -tag -width indent
248.It Fl o
249Options are specified with a
250.Fl o
251flag followed by a comma separated string of options.
252See the
253.Xr mount 8
254man page for possible options and their meanings.
255.El
256.Sh SEE ALSO
257.Xr disktab 5 ,
258.Xr fs 5 ,
259.Xr dumpfs 8 ,
260.Xr disklabel 8 ,
261.Xr diskpart 8 ,
262.Xr fsck 8 ,
263.Xr format 8 ,
264.Xr mount 8 ,
265.Xr tunefs 8
266.Rs
267.%A M. McKusick
268.%A W. Joy
269.%A S. Leffler
270.%A R. Fabry
271.%T A Fast File System for UNIX ,
272.%J ACM Transactions on Computer Systems 2
273.%V 3
274.%P pp 181-197
275.%D August 1984
276.%O (reprinted in the BSD System Manager's Manual)
277.Re
278.Sh HISTORY
279The
280.Nm
281command appeared in
282.Bx 4.2 .
283