]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sbin/newfs/newfs.8
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / sbin / newfs / newfs.8
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 .\" 4. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)newfs.8     8.6 (Berkeley) 5/3/95
29 .\" $FreeBSD$
30 .\"
31 .Dd March 21, 2008
32 .Dt NEWFS 8
33 .Os
34 .Sh NAME
35 .Nm newfs
36 .Nd construct a new UFS1/UFS2 file system
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl JNUln
40 .Op Fl L Ar volname
41 .Op Fl O Ar filesystem-type
42 .Op Fl S Ar sector-size
43 .Op Fl T Ar disktype
44 .Op Fl a Ar maxcontig
45 .Op Fl b Ar block-size
46 .Op Fl c Ar blocks-per-cylinder-group
47 .Op Fl d Ar max-extent-size
48 .Op Fl e Ar maxbpg
49 .Op Fl f Ar frag-size
50 .Op Fl g Ar avgfilesize
51 .Op Fl h Ar avgfpdir
52 .Op Fl i Ar bytes
53 .Op Fl m Ar free-space
54 .Op Fl o Ar optimization
55 .Op Fl s Ar size
56 .Ar special
57 .Sh DESCRIPTION
58 The
59 .Nm
60 utility is used to initialize and clear file systems before first use.
61 Before running
62 .Nm
63 the disk must be labeled using
64 .Xr bsdlabel 8 .
65 The
66 .Nm
67 utility builds a file system on the specified special file.
68 (We often refer to the
69 .Dq special file
70 as the
71 .Dq disk ,
72 although the special file need not be a physical disk.
73 In fact, it need not even be special.)
74 Typically the defaults are reasonable, however
75 .Nm
76 has numerous options to allow the defaults to be selectively overridden.
77 .Pp
78 The following options define the general layout policies:
79 .Bl -tag -width indent
80 .It Fl J
81 Enable journaling on the new file system via gjournal.
82 .It Fl L Ar volname
83 Add a volume label to the new file system.
84 .It Fl N
85 Cause the file system parameters to be printed out
86 without really creating the file system.
87 .It Fl O Ar filesystem-type
88 Use 1 to specify that a UFS1 format file system be built;
89 use 2 to specify that a UFS2 format file system be built.
90 The default format is UFS2.
91 .It Fl T Ar disktype
92 For backward compatibility.
93 .It Fl U
94 Enable soft updates on the new file system.
95 .It Fl a Ar maxcontig
96 Specify the maximum number of contiguous blocks that will be
97 laid out before forcing a rotational delay.
98 The default value is 16.
99 See
100 .Xr tunefs 8
101 for more details on how to set this option.
102 .It Fl b Ar block-size
103 The block size of the file system, in bytes.
104 It must be a power of 2.
105 The
106 default size is 16384 bytes, and the smallest allowable size is 4096 bytes.
107 The optimal block:fragment ratio is 8:1.
108 Other ratios are possible, but are not recommended,
109 and may produce poor results.
110 .It Fl c Ar blocks-per-cylinder-group
111 The number of blocks per cylinder group in a file system.
112 The default is to compute the maximum allowed by the other parameters.
113 This value is
114 dependent on a number of other parameters, in particular the block size
115 and the number of bytes per inode.
116 .It Fl d Ar max-extent-size
117 The file system may choose to store large files using extents.
118 This parameter specifies the largest extent size that may be used.
119 It is presently limited to its default value which is 16 times
120 the file system blocksize.
121 .It Fl e Ar maxbpg
122 Indicate the maximum number of blocks any single file can
123 allocate out of a cylinder group before it is forced to begin
124 allocating blocks from another cylinder group.
125 The default is about one quarter of the total blocks in a cylinder group.
126 See
127 .Xr tunefs 8
128 for more details on how to set this option.
129 .It Fl f Ar frag-size
130 The fragment size of the file system in bytes.
131 It must be a power of two
132 ranging in value between
133 .Ar blocksize Ns /8
134 and
135 .Ar blocksize .
136 The default is 2048 bytes.
137 .It Fl g Ar avgfilesize
138 The expected average file size for the file system.
139 .It Fl h Ar avgfpdir
140 The expected average number of files per directory on the file system.
141 .It Fl i Ar bytes
142 Specify the density of inodes in the file system.
143 The default is to create an inode for every
144 .Pq 4 * Ar frag-size
145 bytes of data space.
146 If fewer inodes are desired, a larger number should be used;
147 to create more inodes a smaller number should be given.
148 One inode is required for each distinct file, so this value effectively
149 specifies the average file size on the file system.
150 .It Fl l
151 Enable multilabel MAC on the new file system.
152 .It Fl m Ar free-space
153 The percentage of space reserved from normal users; the minimum free
154 space threshold.
155 The default value used is
156 defined by
157 .Dv MINFREE
158 from
159 .In ufs/ffs/fs.h ,
160 currently 8%.
161 See
162 .Xr tunefs 8
163 for more details on how to set this option.
164 .It Fl n
165 Do not create a
166 .Pa .snap
167 directory on the new file system.
168 The resulting file system will not support snapshot generation, so
169 .Xr dump 8
170 in live mode and background
171 .Xr fsck 8
172 will not function properly.
173 The traditional
174 .Xr fsck 8
175 and offline
176 .Xr dump 8
177 will work on the file system.
178 This option is intended primarily for memory or vnode-backed file systems that
179 do not require
180 .Xr dump 8
181 or
182 .Xr fsck 8
183 support.
184 .It Fl o Ar optimization
185 .Cm ( space
186 or
187 .Cm time ) .
188 The file system can either be instructed to try to minimize the time spent
189 allocating blocks, or to try to minimize the space fragmentation on the disk.
190 If the value of minfree (see above) is less than 8%,
191 the default is to optimize for
192 .Cm space ;
193 if the value of minfree is greater than or equal to 8%,
194 the default is to optimize for
195 .Cm time .
196 See
197 .Xr tunefs 8
198 for more details on how to set this option.
199 .It Fl s Ar size
200 The size of the file system in sectors.
201 This value defaults to the size of the
202 raw partition specified in
203 .Ar special
204 (in other words,
205 .Nm
206 will use the entire partition for the file system).
207 .El
208 .Pp
209 The following options override the standard sizes for the disk geometry.
210 Their default values are taken from the disk label.
211 Changing these defaults is useful only when using
212 .Nm
213 to build a file system whose raw image will eventually be used on a
214 different type of disk than the one on which it is initially created
215 (for example on a write-once disk).
216 Note that changing any of these values from their defaults will make
217 it impossible for
218 .Xr fsck 8
219 to find the alternate superblocks if the standard superblock is lost.
220 .Bl -tag -width indent
221 .It Fl S Ar sector-size
222 The size of a sector in bytes (almost never anything but 512).
223 .El
224 .Sh EXAMPLES
225 .Dl newfs /dev/ad3s1a
226 .Pp
227 Creates a new ufs file system on
228 .Pa ad3s1a .
229 The
230 .Nm
231 utility will use a block size of 16384 bytes, a fragment size of 2048 bytes
232 and the largest possible number of blocks per cylinders group.
233 These values tend to produce better performance for most applications
234 than the historical defaults
235 (8192 byte block size and 1024 byte fragment size).
236 This large fragment size may lead to much wasted space
237 on file systems that contain many small files.
238 .Sh SEE ALSO
239 .Xr fdformat 1 ,
240 .Xr disktab 5 ,
241 .Xr fs 5 ,
242 .Xr bsdlabel 8 ,
243 .Xr camcontrol 8 ,
244 .Xr dump 8 ,
245 .Xr dumpfs 8 ,
246 .Xr fsck 8 ,
247 .Xr mount 8 ,
248 .Xr tunefs 8 ,
249 .Xr gvinum 8
250 .Rs
251 .%A M. McKusick
252 .%A W. Joy
253 .%A S. Leffler
254 .%A R. Fabry
255 .%T A Fast File System for UNIX
256 .%J ACM Transactions on Computer Systems 2
257 .%V 3
258 .%P pp 181-197
259 .%D August 1984
260 .%O (reprinted in the BSD System Manager's Manual)
261 .Re
262 .Sh HISTORY
263 The
264 .Nm
265 utility appeared in
266 .Bx 4.2 .