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