xref: /original-bsd/sbin/newfs/newfs.8 (revision 27393bdf)
1.\" Copyright (c) 1983, 1987, 1991, 1993, 1994
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)newfs.8	8.5 (Berkeley) 07/24/94
7.\"
8.Dd
9.Dt NEWFS 8
10.Os BSD 4.2
11.Sh NAME
12.Nm newfs ,
13.Nm mount_mfs
14.Nd construct a new file system
15.Sh SYNOPSIS
16.Nm newfs
17.Op Fl NO
18.Op Fl S Ar sector-size
19.Op Fl a maxcontig
20.Op Fl b Ar block-size
21.Op Fl c Ar cylinders
22.Op Fl d Ar rotdelay
23.Op Fl e Ar maxbpg
24.Op Fl f Ar frag-size
25.Op Fl i Ar bytes
26.Op Fl k Ar skew
27.Op Fl l Ar interleave
28.Op Fl m Ar free space
29.Op Fl o Ar optimization
30.Op Fl p Ar sectors
31.Op Fl r Ar revolutions
32.Op Fl s Ar size
33.Op Fl t Ar tracks
34.Op Fl u Ar sectors
35.Op Fl x Ar sectors
36.Ar special
37.Nm mount_mfs
38.Op Fl N
39.Op Fl a maxcontig
40.Op Fl b Ar block-size
41.Op Fl c Ar cylinders
42.Op Fl d Ar rotdelay
43.Op Fl e Ar maxbpg
44.Op Fl f Ar frag-size
45.Op Fl i Ar bytes
46.Op Fl m Ar free space
47.Op Fl o Ar options
48.Op Fl s Ar size
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 mount_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 Mount_mfs
69is used to build a file system in virtual memory and then mount it
70on a specified node.
71.Nm Mount_mfs
72exits and the contents of the file system are lost
73when the file system is unmounted.
74If
75.Nm mount_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 mount_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 O
97Creates a 4.3BSD format filesystem.
98This options is primarily used to build root filesystems
99that can be understood by older boot ROMs.
100.It Fl a Ar maxcontig
101This specifies the maximum number of contiguous blocks that will be
102laid out before forcing a rotational delay (see the
103.Fl d
104option).
105The default value is one.
106See
107.Xr tunefs 8
108for more details on how to set this option.
109.It Fl b Ar block-size
110The block size of the file system, in bytes.
111.It Fl c Ar #cylinders/group
112The number of cylinders per cylinder group in a file system.
113The default value is 16.
114.It Fl d Ar rotdelay
115This specifies the expected time (in milliseconds) to service a transfer
116completion interrupt and initiate a new transfer on the same disk.
117The default is 4 milliseconds.
118See
119.Xr tunefs 8
120for more details on how to set this option.
121.ne 1i
122.It Fl e Ar maxbpg
123This indicates the maximum number of blocks any single file can
124allocate out of a cylinder group before it is forced to begin
125allocating blocks from another cylinder group.
126The default is about one quarter of the total blocks in a cylinder group.
127See
128.Xr tunefs 8
129for more details on how to set this option.
130.It Fl f Ar frag-size
131The fragment size of the file system in bytes.
132.It Fl i Ar number of bytes per inode
133This specifies the density of inodes in the file system.
134The default is to create an inode for each 2048 bytes of data space.
135If fewer inodes are desired, a larger number should be used;
136to create more inodes a smaller number should be given.
137.It Fl m Ar free space \&%
138The percentage of space reserved from normal users; the minimum free
139space threshold.
140The default value used is 10%.
141See
142.Xr tunefs 8
143for more details on how to set this option.
144.It Fl o Ar optimization\ preference
145.Pq ``space'' or ``time''
146The file system can either be instructed to try to minimize the time spent
147allocating blocks, or to try to minimize the space fragmentation on the disk.
148If the value of minfree (see above) is less than 10%,
149the default is to optimize for space;
150if the value of minfree is greater than or equal to 10%,
151the default is to optimize for time.
152See
153.Xr tunefs 8
154for more details on how to set this option.
155.It Fl s Ar size
156The size of the file system in sectors.
157.El
158.Pp
159The following options override the standard sizes for the disk geometry.
160Their default values are taken from the disk label.
161Changing these defaults is useful only when using
162.Nm newfs
163to build a file system whose raw image will eventually be used on a
164different type of disk than the one on which it is initially created
165(for example on a write-once disk).
166Note that changing any of these values from their defaults will make
167it impossible for
168.Xr fsck
169to find the alternate superblocks if the standard superblock is lost.
170.Bl -tag -width Fl
171.It Fl S Ar sector-size
172The size of a sector in bytes (almost never anything but 512).
173.It Fl k Ar sector \&0 skew , per track
174Used to describe perturbations in the media format to compensate for
175a slow controller.
176Track skew is the offset of sector 0 on track N relative to sector 0
177on track N-1 on the same cylinder.
178.It Fl l Ar hardware sector interleave
179Used to describe perturbations in the media format to compensate for
180a slow controller.
181Interleave is physical sector interleave on each track,
182specified as the denominator of the ratio:
183.Dl sectors read/sectors passed over
184Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies
185logical sector 0 is separated by one sector from logical sector 1.
186.It Fl p Ar spare sectors per track
187Spare sectors (bad sector replacements) are physical sectors that occupy
188space at the end of each track.
189They are not counted as part of the sectors/track
190.Pq Fl u
191since they are not available to the file system for data allocation.
192.It Fl r Ar revolutions/minute
193The speed of the disk in revolutions per minute.
194.ne 1i
195.It Fl t Ar #tracks/cylinder
196The number of tracks/cylinder available for data allocation by the file
197system.
198.It Fl u Ar sectors/track
199The number of sectors per track available for data allocation by the file
200system.
201This does not include sectors reserved at the end of each track for bad
202block replacement (see the
203.Fl p
204option.)
205.It Fl x Ar spare sectors per cylinder
206Spare sectors (bad sector replacements) are physical sectors that occupy
207space at the end of the last track in the cylinder.
208They are deducted from the sectors/track
209.Pq Fl u
210of the last track of each cylinder since they are not available to the file
211system for data allocation.
212.El
213.Pp
214The options to the
215.Nm mount_mfs
216command are as described for the
217.Nm newfs
218command, except for the
219.Fl o
220option.
221.Pp
222That option is as follows:
223.Bl -tag -width indent
224.It Fl o
225Options are specified with a
226.Fl o
227flag followed by a comma separated string of options.
228See the
229.Xr mount 8
230man page for possible options and their meanings.
231.El
232.Sh SEE ALSO
233.Xr disktab 5 ,
234.Xr fs 5 ,
235.Xr dumpfs 8 ,
236.Xr disklabel 8 ,
237.Xr diskpart 8 ,
238.Xr fsck 8 ,
239.Xr format 8 ,
240.Xr mount 8 ,
241.Xr tunefs 8
242.Rs
243.%A M. McKusick
244.%A W. Joy
245.%A S. Leffler
246.%A R. Fabry
247.%T A Fast File System for UNIX ,
248.%J ACM Transactions on Computer Systems 2
249.%V 3
250.%P pp 181-197
251.%D August 1984
252.%O (reprinted in the BSD System Manager's Manual)
253.Re
254.Sh HISTORY
255The
256.Nm
257command appeared in
258.Bx 4.2 .
259