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