Whamcloud - gitweb
mke2fs: New bitmap and inode table allocation for FLEX_BG
[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 \-G
30 .I number-of-groups
31 ]
32 [
33 .B \-i
34 .I bytes-per-inode
35 ]
36 [
37 .B \-I
38 .I inode-size
39 ]
40 [
41 .B \-j
42 ]
43 [
44 .B \-J
45 .I journal-options
46 ]
47 [
48 .B \-N
49 .I number-of-inodes
50 ]
51 [
52 .B -n
53 ]
54 [
55 .B \-m
56 .I reserved-blocks-percentage
57 ]
58 [
59 .B \-o
60 .I creator-os
61 ]
62 [
63 .B \-O 
64 .IR feature [,...]
65 ]
66 [
67 .B \-q
68 ]
69 [
70 .B \-r
71 .I fs-revision-level
72 ]
73 [
74 .B \-E
75 .I extended-options
76 ]
77 [
78 .B \-v
79 ]
80 [
81 .B \-F
82 ]
83 [
84 .B \-L
85 .I volume-label
86 ]
87 [
88 .B \-M
89 .I last-mounted-directory
90 ]
91 [
92 .B \-S
93 ]
94 [
95 .B \-t
96 .I fs-type
97 ]
98 [
99 .B \-T
100 .I usage-type
101 ]
102 [
103 .B \-V
104 ]
105 .I device
106 [
107 .I blocks-count
108 ]
109 @JDEV@.sp
110 @JDEV@.B "mke2fs \-O journal_dev"
111 @JDEV@[
112 @JDEV@.B \-b
113 @JDEV@.I block-size
114 @JDEV@]
115 .\" No external-journal specific journal options yet (size is ignored)
116 .\" @JDEV@[
117 .\" @JDEV@.B \-J
118 .\" @JDEV@.I journal-options
119 .\" @JDEV@]
120 @JDEV@[
121 @JDEV@.B \-L
122 @JDEV@.I volume-label
123 @JDEV@]
124 @JDEV@[
125 @JDEV@.B \-n
126 @JDEV@]
127 @JDEV@[
128 @JDEV@.B \-q
129 @JDEV@]
130 @JDEV@[
131 @JDEV@.B \-v
132 @JDEV@]
133 @JDEV@.I external-journal
134 @JDEV@[
135 @JDEV@.I blocks-count
136 @JDEV@]
137 .SH DESCRIPTION
138 .B mke2fs
139 is used to create an ext2/ext3 filesystem (usually in a disk partition).
140 .I device
141 is the special file corresponding to the device (e.g 
142 .IR /dev/hdXX ).
143 .I blocks-count
144 is the number of blocks on the device.  If omitted,
145 .B mke2fs
146 automagically figures the file system size.  If called as
147 .B mkfs.ext3
148 a journal is created as if the
149 .B \-j
150 option was specified.
151 .SH OPTIONS
152 .TP
153 .BI \-b " block-size"
154 Specify the size of blocks in bytes.  Valid block size vales are 1024, 
155 2048 and 4096 bytes per block.  If omitted,
156 .B mke2fs
157 block-size is heuristically determined by the file system size and
158 the expected usage of the filesystem (see the
159 .B \-T
160 option).  If 
161 .I block-size
162 is negative, then 
163 .B mke2fs
164 will use heuristics to determine the
165 appropriate block size, with the constraint that the block size will be
166 at least 
167 .I block-size
168 bytes.  This is useful for certain hardware devices which require that
169 the blocksize be a multiple of 2k.
170 .TP
171 .B \-c
172 Check the device for bad blocks before creating the file system.  If
173 this option is specified twice, then a slower, read-write
174 test is used instead of a fast read-only test.
175 .TP
176 .BI \-E " extended-options"
177 Set extended options for the filesystem.  Extended options are comma
178 separated, and may take an argument using the equals ('=') sign.  The
179 .B -E
180 option used to be 
181 .B -R
182 in earlier versions of 
183 .BR mke2fs .
184 The 
185 .B -R
186 option is still accepted for backwards compatibility.   The 
187 following extended options are supported:
188 .RS 1.2i
189 .TP
190 .BI stride= stride-size
191 Configure the filesystem for a RAID array with
192 .I stride-size
193 filesystem blocks. This is the number of blocks read or written to disk
194 before moving to next disk. This mostly affects placement of filesystem
195 metadata like bitmaps at
196 .B mke2fs
197 time to avoid placing them on a single disk, which can hurt the performanace.
198 It may also be used by block allocator.
199 .TP
200 .BI stripe-width= stripe-width
201 Configure the filesystem for a RAID array with
202 .I stripe-width
203 filesystem blocks per stripe. This is typically be stride-size * N, where
204 N is the number of data disks in the RAID (e.g. RAID 5 N+1, RAID 6 N+2).
205 This allows the block allocator to prevent read-modify-write of the
206 parity in a RAID stripe if possible when the data is written.
207 .TP
208 .BI resize= max-online-resize
209 Reserve enough space so that the block group descriptor table can grow
210 to support a filesystem that has max-online-resize blocks.
211 .TP
212 .B lazy_itable_init= \fI<0 to disable, 1 to enable>
213 If enabled and the uninit_bg feature is enabled, the inode table will
214 not fully initialized by 
215 .BR mke2fs .
216 This speeds up filesystem
217 initialization noitceably, but it requires the kernel to finish
218 initializing the filesystem in the background when the filesystem is
219 first mounted.
220 .TP
221 .B test_fs
222 Set a flag in the filesystem superblock indicating that it may be
223 mounted using experimental kernel code, such as the ext4dev filesystem.
224 .RE
225 .TP
226 .BI \-f " fragment-size"
227 Specify the size of fragments in bytes.
228 .TP
229 .B \-F
230 Force 
231 .B mke2fs
232 to create a filesystem, even if the specified device is not a partition
233 on a block special device, or if other parameters do not make sense.
234 In order to force 
235 .B mke2fs
236 to create a filesystem even if the filesystem appears to be in use 
237 or is mounted (a truly dangerous thing to do), this option must be
238 specified twice.
239 .TP
240 .BI \-g " blocks-per-group"
241 Specify the number of blocks in a block group.  There is generally no
242 reason the user to ever set this parameter, as the default is optimal
243 for the filesystem.  (For administrators who are creating
244 filesystems on RAID arrays, it is preferable to use the
245 .I stride
246 RAID parameter as part of the
247 .B \-E
248 option rather than manipulating the number of blocks per group.)  
249 This option is generally used by developers who
250 are developing test cases.  
251 .TP
252 .BI \-G " number-of-groups"
253 Specify the number of block goups that will be packed together to
254 create one large virtual block group on an ext4 filesystem.  This
255 improves meta-data locality and performance on meta-data heavy
256 workloads.  The number of goups must be a power of 2 and may only be
257 specified if the flex_bg filesystem feature is enabled.
258 .TP
259 .BI \-i " bytes-per-inode"
260 Specify the bytes/inode ratio. 
261 .B mke2fs
262 creates an inode for every
263 .I bytes-per-inode
264 bytes of space on the disk.  The larger the 
265 .I bytes-per-inode
266 ratio, the fewer inodes will be created.  This value generally shouldn't
267 be smaller than the blocksize of the filesystem, since then too many
268 inodes will be made.  Be warned that is not possible to expand the number 
269 of inodes on a filesystem after it is created, so be careful deciding the
270 correct value for this parameter. 
271 .TP
272 .BI \-I " inode-size"
273 Specify the size of each inode in bytes. 
274 .B mke2fs
275 creates 256-byte inodes by default.  In kernels after 2.6.10 and some
276 earlier vendor kernels it is possible to utilize inodes larger than
277 128-bytes to store
278 extended attributes for improved performance.  The 
279 .I inode-size
280 value must be a power of two larger or equal to 128.  The larger the 
281 .I inode-size
282 the more space the inode table will consume, and this reduces the usable
283 space in the filesystem and can also negatively impact performance.  
284 Extended attributes
285 stored in large inodes are not visible with older kernels, and such
286 filesystems will not be mountable with 2.4 kernels at all.  It is not
287 possible to change this value after the filesystem is created.
288 .TP 
289 .B \-j
290 Create the filesystem with an ext3 journal.  If the
291 .B \-J
292 option is not specified, the default journal parameters will be used to
293 create an appropriately sized journal (given the size of the filesystem) 
294 stored within the filesystem.  Note that you must be using a kernel
295 which has ext3 support in order to actually make use of the journal.
296 .TP
297 .BI \-J " journal-options"
298 Create the ext3 journal using options specified on the command-line.
299 Journal options are comma
300 separated, and may take an argument using the equals ('=')  sign.
301 The following journal options are supported:
302 .RS 1.2i
303 .TP
304 .BI size= journal-size
305 Create an internal journal (i.e., stored inside the filesystem) of size
306 .I journal-size 
307 megabytes.
308 The size of the journal must be at least 1024 filesystem blocks 
309 (i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.) 
310 and may be no more than 102,400 filesystem blocks.  
311 @JDEV@.TP
312 @JDEV@.BI device= external-journal
313 @JDEV@Attach the filesystem to the journal block device located on
314 @JDEV@.IR external-journal .
315 @JDEV@The external
316 @JDEV@journal must already have been created using the command
317 @JDEV@.IP
318 @JDEV@.B mke2fs -O journal_dev
319 @JDEV@.I external-journal
320 @JDEV@.IP
321 @JDEV@Note that
322 @JDEV@.I external-journal
323 @JDEV@must have been created with the
324 @JDEV@same block size as the new filesystem.
325 @JDEV@In addition, while there is support for attaching
326 @JDEV@multiple filesystems to a single external journal,
327 @JDEV@the Linux kernel and 
328 @JDEV@.BR e2fsck (8)
329 @JDEV@do not currently support shared external journals yet.
330 @JDEV@.IP
331 @JDEV@Instead of specifying a device name directly,
332 @JDEV@.I external-journal
333 @JDEV@can also be specified by either
334 @JDEV@.BI LABEL= label
335 @JDEV@or
336 @JDEV@.BI UUID= UUID
337 @JDEV@to locate the external journal by either the volume label or UUID
338 @JDEV@stored in the ext2 superblock at the start of the journal.  Use
339 @JDEV@.BR dumpe2fs (8)
340 @JDEV@to display a journal device's volume label and UUID.  See also the
341 @JDEV@.B -L
342 @JDEV@option of
343 @JDEV@.BR tune2fs (8).
344 .RE
345 @JDEV@.IP
346 @JDEV@Only one of the
347 @JDEV@.BR size " or " device
348 @JDEV@options can be given for a filesystem.
349 .TP
350 .BI \-l " filename"
351 Read the bad blocks list from
352 .IR filename .  
353 Note that the block numbers in the bad block list must be generated
354 using the same block size as used by mke2fs.  As a result, the
355 .B \-c
356 option to 
357 .B mke2fs
358 is a much simpler and less error-prone method of checking a disk for bad
359 blocks before formatting it, as 
360 .B mke2fs
361 will automatically pass the correct parameters to the
362 .B badblocks
363 program.
364 .TP
365 .BI \-L " new-volume-label"
366 Set the volume label for the filesystem to
367 .IR new-volume-label .
368 The maximum length of the
369 volume label is 16 bytes.
370 .TP
371 .BI \-m " reserved-blocks-percentage"
372 Specify the percentage of the filesystem blocks reserved for 
373 the super-user.  This avoids fragmentation, and allows root-owned
374 daemons, such as 
375 .BR syslogd (8),
376 to continue to function correctly after non-privileged processes are 
377 prevented from writing to the filesystem.  The default percentage 
378 is 5%.
379 .TP
380 .B \-M
381 Set the last mounted directory for the filesystem.  This might be useful 
382 for the sake of utilities that key off of the last mounted directory to 
383 determine where the filesystem should be mounted.
384 .TP
385 .B \-n
386 causes mke2fs to not actually create a filesystem, but display what it
387 would do if it were to create a filesystem.  This can be used to
388 determine the location of the backup superblocks for a particular
389 filesystem, so long as the mke2fs parameters that were passed when the
390 filesystem was originally created are used again.  (With the
391 .B \-n 
392 option added, of course!)
393 .TP
394 .BI \-N " number-of-inodes"
395 overrides the default calculation of the number of inodes that should be 
396 reserved for the filesystem (which is based on the number of blocks and 
397 the 
398 .I bytes-per-inode
399 ratio).  This allows the user to specify the number 
400 of desired inodes directly.
401 .TP
402 .BI \-o " creator-os"
403 Manually override the default value of the "creator os" field of the 
404 filesystem.  Normally the creator field is set by default to the native OS
405 of the
406 .B mke2fs
407 executable.
408 .TP
409 .B "\-O \fIfeature\fR[,...]"
410 Create filesystem with given features (filesystem options), overriding 
411 the default filesystem options.  The default features which are
412 enabled by default are specified by the
413 .I base_features
414 relation, either in the
415 .I [libdefaults]
416 section in the
417 .B /etc/mke2fs.conf
418 configuration file,
419 or in the subsection of the
420 .I [fs_types]
421 section for the usage types as specified by the
422 .B -T
423 option, further modified by the
424 .I features
425 relation found in the
426 .I [fs_types] section
427 based on the filesystem and usage types.  See the
428 .BR mke2fs.conf (5)
429 manual page for more details.
430 The filesystem type-specific configuration setting found in the
431 .I [fs_types]
432 section will override the global default found in
433 .IR [libdefaults] .
434 .sp
435 The filesystem feature set will be further edited 
436 using either the feature set specification specified by this option, 
437 or if this option is not specified, by the
438 .I default_features
439 relation for the filesystem type being created, or in the 
440 .I [libdefaults]
441 section of the configuration file.
442 .sp
443 The filesystem feature set is comprised of a list of features, separated
444 by commas, that are to be enabled.  To disable a feature, simply
445 prefix the feature name with a  caret ('^') character.  The 
446 pseudo-filesystem feature "none" will clear all filesystem features.
447 .RS 1.2i
448 .TP
449 .B large_file
450 Filesystem can contain files that are greater than 2GB.  (Modern kernels
451 set this feature automatically when a file > 2GB is created.)
452 .TP
453 .B dir_index
454 Use hashed b-trees to speed up lookups in large directories.
455 .TP
456 .B filetype
457 Store file type information in directory entries.
458 .TP
459 .B flex_bg
460 Allow bitmaps and inode tables for a block group to be placed anywhere
461 on the storage media (use with -G option to group meta-data in order
462 to create a large virtual block group).
463 .TP
464 .B has_journal
465 Create an ext3 journal (as if using the
466 .B \-j
467 option).
468 @JDEV@.TP
469 @JDEV@.B journal_dev
470 @JDEV@Create an external ext3 journal on the given device
471 @JDEV@instead of a regular ext2 filesystem.
472 @JDEV@Note that
473 @JDEV@.I external-journal
474 @JDEV@must be created with the same
475 @JDEV@block size as the filesystems that will be using it.
476 .TP
477 .B extent
478 Instead of using the indirect block scheme for storing the location of
479 data blocks in an inode, use extents instead.  This is a much more
480 efficient encoding which speeds up filesystem access, especially for
481 large files.
482 .TP
483 .B uninit_bg
484 Create a filesystem without initializing all of the block groups.  This 
485 feature also enables checksums and highest-inode-used statistics in each
486 blockgroup.  This feature can
487 speed up filesystem creation time noticably (if lazy_itable_init is
488 enabled), and can also reduce
489 .BR e2fsck time
490 dramatically.  It is only supported by the ext4 filesystem in
491 recent Linux kernels.
492 .TP
493 .B resize_inode
494 Reserve space so the block group descriptor table may grow in the future.
495 Useful for online resizing using 
496 .BR resize2fs .
497 By default 
498 .B mke2fs
499 will attempt to reserve enough space so that the
500 filesystem may grow to 1024 times its initial size.  This can be changed
501 using
502 .B resize
503 extended option.
504 .TP
505 .B sparse_super
506 Create a filesystem with fewer superblock backup copies
507 (saves space on large filesystems).
508 .RE
509 .TP
510 .B \-q
511 Quiet execution.  Useful if 
512 .B mke2fs
513 is run in a script.
514 .TP
515 .BI \-r " revision"
516 Set the filesystem revision for the new filesystem.  Note that 1.2
517 kernels only support revision 0 filesystems.  The default is to 
518 create revision 1 filesystems.
519 .TP
520 .B \-S
521 Write superblock and group descriptors only.  This is useful if all of
522 the superblock and backup superblocks are corrupted, and a last-ditch
523 recovery method is desired.  It causes 
524 .B mke2fs
525 to reinitialize the 
526 superblock and group descriptors, while not touching the inode table
527 and the block and inode bitmaps.  The
528 .B e2fsck
529 program should be run immediately after this option is used, and there
530 is no guarantee that any data will be salvageable.  It is critical to
531 specify the correct filesystem blocksize when using this option,
532 or there is no chance of recovery.
533 .\" .TP
534 .\" .BI \-t " test"
535 .\" Check the device for bad blocks before creating the file system
536 .\" using the specified test.
537 .TP
538 .BI
539 .BI \-t " fs-type"
540 Specify the filesystem (i.e., ext2, ext3, ext4, etc., is to be created.
541 If this option is not specified mke2fs will pick a default either how
542 the command was run (if it was run using a name of the form mkfs.ext2,
543 mkfs.ext3, etc.) or via a default as defined by the
544 .BR /etc/mke2fs.conf (5)
545 file.
546 .TP
547 .BI \-T " usage-type[,...]"
548 Specify how the filesystem is going to be used, so that 
549 .B mke2fs 
550 can choose optimal filesystem parameters for that use.  The usage
551 types that are supported are defined in the configuration file
552 .BR /etc/mke2fs.conf (5).
553 The user may specify one or more usage types
554 using a comma separated list.
555 .sp
556 If this option is is not specified,
557 .B mke2fs
558 will pick a single default usage type based on the size of the filesystem to
559 be created.  If the filesystem size is less than or equal to 3 megabytes,
560 .B mke2fs
561 will use the filesystem type
562 .IR floppy .
563 If the filesystem size is greater than 3 but less than or equal to
564 512 megabytes,
565 .BR mke2fs (8)
566 will use the filesystem
567 .IR small .
568 Otherwise,
569 .BR mke2fs (8)
570 will use the default filesystem type
571 .IR default .
572 .TP
573 .B \-v
574 Verbose execution.
575 .TP
576 .B \-V
577 Print the version number of 
578 .B mke2fs
579 and exit.
580 .SH AUTHOR
581 This version of
582 .B mke2fs
583 has been written by Theodore Ts'o <tytso@mit.edu>.
584 .SH BUGS
585 .B mke2fs
586 accepts the
587 .B \-f
588 option but currently ignores it because the second
589 extended file system does not support fragments yet.
590 .br
591 There may be other ones.  Please, report them to the author.
592 .SH AVAILABILITY
593 .B mke2fs
594 is part of the e2fsprogs package and is available from 
595 http://e2fsprogs.sourceforge.net.
596 .SH SEE ALSO
597 .BR mke2fs.conf (5),
598 .BR badblocks (8),
599 .BR dumpe2fs (8),
600 .BR e2fsck (8),
601 .BR tune2fs (8)