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