Whamcloud - gitweb
mke2fs.c (parse_extended_opts): Rename the -R option to -E. Fix
[tools/e2fsprogs.git] / misc / mke2fs.8.in
1 .\" -*- nroff -*-
2 .\" Copyright 1993, 1994, 1995 by Theodore Ts'o.  All Rights Reserved.
3 .\" This file may be copied under the terms of the GNU Public License.
4 .\" 
5 .TH MKE2FS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
6 .SH NAME
7 mke2fs \- create an ext2/ext3 filesystem
8 .SH SYNOPSIS
9 .B mke2fs
10 [
11 .B \-c
12
13 .B \-l
14 .I filename
15 ]
16 [
17 .B \-b
18 .I block-size
19 ]
20 [
21 .B \-f
22 .I fragment-size
23 ]
24 [
25 .B \-g
26 .I blocks-per-group
27 ]
28 [
29 .B \-i
30 .I bytes-per-inode
31 ]
32 [
33 .B \-j
34 ]
35 [
36 .B \-J
37 .I journal-options
38 ]
39 [
40 .B \-N
41 .I number-of-inodes
42 ]
43 [
44 .B -n
45 ]
46 [
47 .B \-m
48 .I reserved-blocks-percentage
49 ]
50 [
51 .B \-o
52 .I creator-os
53 ]
54 [
55 .B \-O 
56 .IR feature [,...]
57 ]
58 [
59 .B \-q
60 ]
61 [
62 .B \-r
63 .I fs-revision-level
64 ]
65 [
66 .B \-E
67 .I extended-options
68 ]
69 [
70 .B \-v
71 ]
72 [
73 .B \-F
74 ]
75 [
76 .B \-L
77 .I volume-label
78 ]
79 [
80 .B \-M
81 .I last-mounted-directory
82 ]
83 [
84 .B \-S
85 ]
86 [
87 .B \-T
88 .I filesystem-type
89 ]
90 [
91 .B \-V
92 ]
93 .I device
94 [
95 .I blocks-count
96 ]
97 @JDEV@.sp
98 @JDEV@.B "mke2fs \-O journal_dev"
99 @JDEV@[
100 @JDEV@.B \-b
101 @JDEV@.I block-size
102 @JDEV@]
103 .\" No external-journal specific journal options yet (size is ignored)
104 .\" @JDEV@[
105 .\" @JDEV@.B \-J
106 .\" @JDEV@.I journal-options
107 .\" @JDEV@]
108 @JDEV@[
109 @JDEV@.B \-L
110 @JDEV@.I volume-label
111 @JDEV@]
112 @JDEV@[
113 @JDEV@.B \-n
114 @JDEV@]
115 @JDEV@[
116 @JDEV@.B \-q
117 @JDEV@]
118 @JDEV@[
119 @JDEV@.B \-v
120 @JDEV@]
121 @JDEV@.I external-journal
122 @JDEV@[
123 @JDEV@.I blocks-count
124 @JDEV@]
125 .SH DESCRIPTION
126 .B mke2fs
127 is used to create an ext2/ext3 filesystem (usually in a disk partition).
128 .I device
129 is the special file corresponding to the device (e.g 
130 .IR /dev/hdXX ).
131 .I blocks-count
132 is the number of blocks on the device.  If omitted,
133 .B mke2fs
134 automagically figures the file system size.  If called as
135 .B mkfs.ext3
136 a journal is created as if the
137 .B \-j
138 option was specified.
139 .SH OPTIONS
140 .TP
141 .BI \-b " block-size"
142 Specify the size of blocks in bytes.  Valid block size vales are 1024, 
143 2048 and 4096 bytes per block.  If omitted,
144 .B mke2fs
145 block-size is heuristically determined by the file system size and
146 the expected usage of the filesystem (see the
147 .B \-T
148 option).  If 
149 .I block-size
150 is negative, then 
151 .B mke2fs
152 will use heuristics to determine the
153 appropriate block size, with the constraint that the block size will be
154 at least 
155 .I block-size
156 bytes.  This is useful for certain hardware devices which require that
157 the blocksize be a multiple of 2k.
158 .TP
159 .B \-c
160 Check the device for bad blocks before creating the file system.  If
161 this option is specified twice, then a slower, read-write
162 test is used instead of a fast read-only test.
163 .TP
164 .BI \-E " extended-options"
165 Set extended options for the filesystem.  Extended options are comma
166 separated, and may take an argument using the equals ('=') sign.  The
167 .B -E
168 option used to be 
169 .B -R
170 in earlier versions of 
171 .BR mke2fs .
172 The 
173 .B -R
174 option is still accepted for backwards compatibility.   The 
175 following extended options are supported:
176 .RS 1.2i
177 .TP
178 .BI stride= stripe-size
179 Configure the filesystem for a RAID array with
180 .I stripe-size
181 filesystem blocks per stripe.
182 .TP
183 .BI resize= max-online-resize
184 Reserve enough space so that the block group descriptor table can grow
185 to support a filesystem that has max-online-resize blocks.
186 .RE
187 .TP
188 .BI \-f " fragment-size"
189 Specify the size of fragments in bytes.
190 .TP
191 .B \-F
192 Force 
193 .B mke2fs
194 to run, even if the specified device is not a 
195 block special device, or appears to be mounted.
196 .TP
197 .BI \-g " blocks-per-group"
198 Specify the number of blocks in a block group.  There is generally no
199 reason the user to ever set this parameter, as the default is optimal
200 for the filesystem.  (For administrators who are creating
201 filesystems on RAID arrays, it is preferable to use the
202 .I stride
203 RAID parameter as part of the
204 .B \-R
205 option rather than manipulating the number of blocks per group.)  
206 This option is generally used by developers who
207 are developing test cases.  
208 .TP
209 .BI \-i " bytes-per-inode"
210 Specify the bytes/inode ratio. 
211 .B mke2fs
212 creates an inode for every
213 .I bytes-per-inode
214 bytes of space on the disk.  The larger the 
215 .I bytes-per-inode
216 ratio, the fewer inodes will be created.  This value generally shouldn't
217 be smaller than the blocksize of the filesystem, since then too many
218 inodes will be made.  Be warned that is not possible to expand the number 
219 of inodes on a filesystem after it is created, so be careful deciding the
220 correct value for this parameter. 
221 .TP 
222 .B \-j
223 Create the filesystem with an ext3 journal.  If the
224 .B \-J
225 option is not specified, the default journal parameters will be used to
226 create an appropriately sized journal (given the size of the filesystem) 
227 stored within the filesystem.  Note that you must be using a kernel
228 which has ext3 support in order to actually make use of the journal.
229 .TP
230 .BI \-J " journal-options"
231 Create the ext3 journal using options specified on the command-line.
232 Journal options are comma
233 separated, and may take an argument using the equals ('=')  sign.
234 The following journal options are supported:
235 .RS 1.2i
236 .TP
237 .BI size= journal-size
238 Create an internal journal (i.e., stored inside the filesystem) of size
239 .I journal-size 
240 megabytes.
241 The size of the journal must be at least 1024 filesystem blocks 
242 (i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.) 
243 and may be no more than 102,400 filesystem blocks.  
244 @JDEV@.TP
245 @JDEV@.BI device= external-journal
246 @JDEV@Attach the filesystem to the journal block device located on
247 @JDEV@.IR external-journal .
248 @JDEV@The external
249 @JDEV@journal must already have been created using the command
250 @JDEV@.IP
251 @JDEV@.B mke2fs -O journal_dev
252 @JDEV@.I external-journal
253 @JDEV@.IP
254 @JDEV@Note that
255 @JDEV@.I external-journal
256 @JDEV@must have been created with the
257 @JDEV@same block size as the new filesystem.
258 @JDEV@.IP
259 @JDEV@Instead of specifying a device name directly,
260 @JDEV@.I external-journal
261 @JDEV@can also be specified by either
262 @JDEV@.BI LABEL= label
263 @JDEV@or
264 @JDEV@.BI UUID= UUID
265 @JDEV@to locate the external journal by either the volume label or UUID
266 @JDEV@stored in the ext2 superblock at the start of the journal.  Use
267 @JDEV@.BR dumpe2fs (8)
268 @JDEV@to display a journal device's volume label and UUID.  See also the
269 @JDEV@.B -L
270 @JDEV@option of
271 @JDEV@.BR tune2fs (8).
272 .RE
273 @JDEV@.IP
274 @JDEV@Only one of the
275 @JDEV@.BR size " or " device
276 @JDEV@options can be given for a filesystem.
277 .TP
278 .BI \-l " filename"
279 Read the bad blocks list from
280 .IR filename .  
281 Note that the block numbers in the bad block list must be generated
282 using the same block size as used by mke2fs.  As a result, the
283 .B \-c
284 option to 
285 .B mke2fs
286 is a much simpler and less error-prone method of checking a disk for bad
287 blocks before formatting it, as 
288 .B mke2fs
289 will automatically pass the correct parameters to the
290 .B badblocks
291 program.
292 .TP
293 .B \-L
294 Set the volume label for the filesystem.
295 .TP
296 .BI \-m " reserved-blocks-percentage"
297 Specify the percentage of the filesystem blocks reserved for 
298 the super-user.  This avoids fragmentation, and allows root-owned
299 daemons, such as 
300 .BR syslogd (8),
301 to continue to function correctly after non-privileged processes are 
302 prevented from writing to the filesystem.  The default percentage 
303 is 5%.
304 .TP
305 .B \-M
306 Set the last mounted directory for the filesystem.  This might be useful 
307 for the sake of utilities that key off of the last mounted directory to 
308 determine where the filesytem should be mounted.
309 .TP
310 .B \-n
311 causes mke2fs to not actually create a filesystem, but display what it
312 would do if it were to create a filesystem.  This can be used to
313 determine the location of the backup superblocks for a particular
314 filesystem, so long as the mke2fs parameters that were passed when the
315 filesystem was originally created are used again.  (With the
316 .B \-n 
317 option added, of course!)
318 .TP
319 .BI \-N " number-of-inodes"
320 overrides the default calculation of the number of inodes that should be 
321 reserved for the filesystem (which is based on the number of blocks and 
322 the 
323 .I bytes-per-inode
324 ratio).  This allows the user to specify the number 
325 of desired inodes directly.
326 .TP
327 .BI \-o " creator-os"
328 Manually override the default value of the "creator os" field of the 
329 filesystem.  Normally the creator field is set by default to the native OS
330 of the
331 .B mke2fs
332 executable.
333 .TP
334 .B "\-O \fIfeature\fR[,...]"
335 Create filesystem with given features (filesystem options), overriding 
336 the default filesystem options.
337 Currently, the
338 .B sparse_super
339 and
340 .B filetype
341 features are turned on by default when 
342 .B mke2fs
343 is run on a system with Linux 2.2 or later (unless creator-os is set to
344 the Hurd).  Filesystems that may need to be mounted on pre-2.2 Linux or
345 other kernels should be created with
346 .B "\-O none"
347 (or
348 .B "\-r 0"
349 for Linux 1.2) which will disable these features, even if 
350 .B mke2fs 
351 is run on a system which can support them.
352 .sp
353 The following filesystem options are supported:
354 .RS 1.2i
355 .TP
356 .B dir_index
357 Use hashed b-trees to speed up lookups in large directories.
358 .TP
359 .B filetype
360 Store file type information in directory entries.
361 .TP
362 .B has_journal
363 Create an ext3 journal (as if using the
364 .B \-j
365 option).
366 @JDEV@.TP
367 @JDEV@.B journal_dev
368 @JDEV@Create an external ext3 journal on the given device
369 @JDEV@instead of a regular ext2 filesystem.
370 @JDEV@Note that
371 @JDEV@.I external-journal
372 @JDEV@must be created with the same
373 @JDEV@block size as the filesystems that will be using it.
374 .TP
375 .B sparse_super
376 Create a filesystem with fewer superblock backup copies
377 (saves space on large filesystems).
378 .RE
379 .TP
380 .B \-q
381 Quiet execution.  Useful if 
382 .B mke2fs
383 is run in a script.
384 .TP
385 .BI \-r " revision"
386 Set the filesystem revision for the new filesystem.  Note that 1.2
387 kernels only support revision 0 filesystems.  The default is to 
388 create revision 1 filesystems.
389 .TP
390 .B \-S
391 Write superblock and group descriptors only.  This is useful if all of
392 the superblock and backup superblocks are corrupted, and a last-ditch
393 recovery method is desired.  It causes 
394 .B mke2fs
395 to reinitialize the 
396 superblock and group descriptors, while not touching the inode table
397 and the block and inode bitmaps.  The
398 .B e2fsck
399 program should be run immediately after this option is used, and there
400 is no guarantee that any data will be salvageable.  It is critical to
401 specify the correct filesystem blocksize when using this option,
402 or there is no chance of recovery.
403 .\" .TP
404 .\" .BI \-t " test"
405 .\" Check the device for bad blocks before creating the file system
406 .\" using the specified test.
407 .TP
408 .BI \-T " fs-type"
409 Specify how the filesystem is going to be used, so that mke2fs can 
410 chose optimal filesystem parameters for that use.  The supported
411 filesystem types are:
412 .RS 1.2i
413 .TP 1.2i
414 news
415 one inode per 4kb block
416 .TP
417 largefile
418 one inode per megabyte
419 .TP
420 largefile4
421 one inode per 4 megabytes
422 .RE
423 .TP
424 .B \-v
425 Verbose execution.
426 .TP
427 .B \-V
428 Print the version number of 
429 .B mke2fs
430 and exit.
431 .SH AUTHOR
432 This version of
433 .B mke2fs
434 has been written by Theodore Ts'o <tytso@mit.edu>.
435 .SH BUGS
436 .B mke2fs
437 accepts the
438 .B \-f
439 option but currently ignores it because the second
440 extended file system does not support fragments yet.
441 .br
442 There may be other ones.  Please, report them to the author.
443 .SH AVAILABILITY
444 .B mke2fs
445 is part of the e2fsprogs package and is available from 
446 http://e2fsprogs.sourceforge.net.
447 .SH SEE ALSO
448 .BR badblocks (8),
449 .BR dumpe2fs (8),
450 .BR e2fsck (8),
451 .BR tune2fs (8)