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