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