xref: /original-bsd/sbin/newfs/newfs.8 (revision e58c8952)
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.3 (Berkeley) 03/27/94
7.\"
8.Dd
9.Dt NEWFS 8
10.Os BSD 4.2
11.Sh NAME
12.Nm newfs ,
13.Nm 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.It Fl e Ar maxbpg
122This indicates the maximum number of blocks any single file can
123allocate out of a cylinder group before it is forced to begin
124allocating blocks from another cylinder group.
125The default is about one quarter of the total blocks in a cylinder group.
126See
127.Xr tunefs 8
128for more details on how to set this option.
129.It Fl f Ar frag-size
130The fragment size of the file system in bytes.
131.It Fl i Ar number of bytes per inode
132This specifies the density of inodes in the file system.
133The default is to create an inode for each 2048 bytes of data space.
134If fewer inodes are desired, a larger number should be used;
135to create more inodes a smaller number should be given.
136.It Fl m Ar free space \&%
137The percentage of space reserved from normal users; the minimum free
138space threshold.
139The default value used is 10%.
140See
141.Xr tunefs 8
142for more details on how to set this option.
143.It Fl o Ar optimization\ preference
144.Pq ``space'' or ``time''
145The file system can either be instructed to try to minimize the time spent
146allocating blocks, or to try to minimize the space fragmentation on the disk.
147If the value of minfree (see above) is less than 10%,
148the default is to optimize for space;
149if the value of minfree is greater than or equal to 10%,
150the default is to optimize for time.
151See
152.Xr tunefs 8
153for more details on how to set this option.
154.It Fl s Ar size
155The size of the file system in sectors.
156.El
157.Pp
158The following options override the standard sizes for the disk geometry.
159Their default values are taken from the disk label.
160Changing these defaults is useful only when using
161.Nm newfs
162to build a file system whose raw image will eventually be used on a
163different type of disk than the one on which it is initially created
164(for example on a write-once disk).
165Note that changing any of these values from their defaults will make
166it impossible for
167.Xr fsck
168to find the alternate superblocks if the standard superblock is lost.
169.Bl -tag -width Fl
170.It Fl S Ar sector-size
171The size of a sector in bytes (almost never anything but 512).
172.It Fl k Ar sector \&0 skew , per track
173Used to describe perturbations in the media format to compensate for
174a slow controller.
175Track skew is the offset of sector 0 on track N relative to sector 0
176on track N-1 on the same cylinder.
177.It Fl l Ar hardware sector interleave
178Used to describe perturbations in the media format to compensate for
179a slow controller.
180Interleave is physical sector interleave on each track,
181specified as the denominator of the ratio:
182.Dl sectors read/sectors passed over
183Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies
184logical sector 0 is separated by one sector from logical sector 1.
185.It Fl p Ar spare sectors per track
186Spare sectors (bad sector replacements) are physical sectors that occupy
187space at the end of each track.
188They are not counted as part of the sectors/track
189.Pq Fl u
190since they are not available to the file system for data allocation.
191.It Fl r Ar revolutions/minute
192The speed of the disk in revolutions per minute.
193.It Fl t Ar #tracks/cylinder
194The number of tracks/cylinder available for data allocation by the file
195system.
196.It Fl u Ar sectors/track
197The number of sectors per track available for data allocation by the file
198system.
199This does not include sectors reserved at the end of each track for bad
200block replacement (see the
201.Fl p
202option.)
203.It Fl x Ar spare sectors per cylinder
204Spare sectors (bad sector replacements) are physical sectors that occupy
205space at the end of the last track in the cylinder.
206They are deducted from the sectors/track
207.Pq Fl u
208of the last track of each cylinder since they are not available to the file
209system for data allocation.
210.El
211.Pp
212The options to the
213.Nm mount_mfs
214command are as described for the
215.Nm newfs
216command, except for the
217.Fl o
218option.
219.Pp
220That option is as follows:
221.Bl -tag -width indent
222.It Fl o
223Options are specified with a
224.Fl o
225flag followed by a comma separated string of options.
226See the
227.Xr mount 8
228man page for possible options and their meanings.
229.El
230.Sh SEE ALSO
231.Xr disktab 5 ,
232.Xr fs 5 ,
233.Xr dumpfs 8 ,
234.Xr disklabel 8 ,
235.Xr diskpart 8 ,
236.Xr fsck 8 ,
237.Xr format 8 ,
238.Xr mount 8 ,
239.Xr tunefs 8
240.Rs
241.%A M. McKusick
242.%A W. Joy
243.%A S. Leffler
244.%A R. Fabry
245.%T A Fast File System for UNIX ,
246.%J ACM Transactions on Computer Systems 2
247.%V 3
248.%P pp 181-197
249.%D August 1984
250.%O (reprinted in the BSD System Manager's Manual)
251.Re
252.Sh HISTORY
253The
254.Nm
255command appeared in
256.Bx 4.2 .
257