Whamcloud - gitweb
390bb8885c3bd728b37edeefcb8075d6f22a164e
[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= stripe-size
183 Configure the filesystem for a RAID array with
184 .I stripe-size
185 filesystem blocks per stripe.
186 .TP
187 .BI resize= max-online-resize
188 Reserve enough space so that the block group descriptor table can grow
189 to support a filesystem that has max-online-resize blocks.
190 .RE
191 .TP
192 .BI \-f " fragment-size"
193 Specify the size of fragments in bytes.
194 .TP
195 .B \-F
196 Force 
197 .B mke2fs
198 to run, even if the specified device is not a 
199 block special device, or appears to be mounted.
200 .TP
201 .BI \-g " blocks-per-group"
202 Specify the number of blocks in a block group.  There is generally no
203 reason the user to ever set this parameter, as the default is optimal
204 for the filesystem.  (For administrators who are creating
205 filesystems on RAID arrays, it is preferable to use the
206 .I stride
207 RAID parameter as part of the
208 .B \-R
209 option rather than manipulating the number of blocks per group.)  
210 This option is generally used by developers who
211 are developing test cases.  
212 .TP
213 .BI \-i " bytes-per-inode"
214 Specify the bytes/inode ratio. 
215 .B mke2fs
216 creates an inode for every
217 .I bytes-per-inode
218 bytes of space on the disk.  The larger the 
219 .I bytes-per-inode
220 ratio, the fewer inodes will be created.  This value generally shouldn't
221 be smaller than the blocksize of the filesystem, since then too many
222 inodes will be made.  Be warned that is not possible to expand the number 
223 of inodes on a filesystem after it is created, so be careful deciding the
224 correct value for this parameter. 
225 .TP
226 .BI \-I " inode-size"
227 Specify the size of each inode in bytes. 
228 .B mke2fs
229 creates 128-byte inodes by default.  In kernels after 2.6.10 and some
230 earlier vendor kernels it is possible to utilize larger inodes to store
231 extended attributes for improved performance.  The 
232 .I inode-size
233 value must be a power of two larger or equal to 128.  The larger the 
234 .I inode-size
235 the more space the inode table will consume, and this reduces the usable
236 space in the filesystem and can also negatively impact performance.  Using
237 the default value is always safe, though it may be desirable to use 256-byte
238 inodes if full backward compatibility is not a concern.  Extended attributes
239 stored in large inodes are not visible with older kernels, and such
240 filesystems will not be mountable with 2.4 kernels at all.  It is not
241 possible to change this value after the filesystem is created.
242 .TP 
243 .B \-j
244 Create the filesystem with an ext3 journal.  If the
245 .B \-J
246 option is not specified, the default journal parameters will be used to
247 create an appropriately sized journal (given the size of the filesystem) 
248 stored within the filesystem.  Note that you must be using a kernel
249 which has ext3 support in order to actually make use of the journal.
250 .TP
251 .BI \-J " journal-options"
252 Create the ext3 journal using options specified on the command-line.
253 Journal options are comma
254 separated, and may take an argument using the equals ('=')  sign.
255 The following journal options are supported:
256 .RS 1.2i
257 .TP
258 .BI size= journal-size
259 Create an internal journal (i.e., stored inside the filesystem) of size
260 .I journal-size 
261 megabytes.
262 The size of the journal must be at least 1024 filesystem blocks 
263 (i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.) 
264 and may be no more than 102,400 filesystem blocks.  
265 @JDEV@.TP
266 @JDEV@.BI device= external-journal
267 @JDEV@Attach the filesystem to the journal block device located on
268 @JDEV@.IR external-journal .
269 @JDEV@The external
270 @JDEV@journal must already have been created using the command
271 @JDEV@.IP
272 @JDEV@.B mke2fs -O journal_dev
273 @JDEV@.I external-journal
274 @JDEV@.IP
275 @JDEV@Note that
276 @JDEV@.I external-journal
277 @JDEV@must have been created with the
278 @JDEV@same block size as the new filesystem.
279 @JDEV@In addition, while there is support for attaching
280 @JDEV@multiple filesystems to a single external journal,
281 @JDEV@the Linux kernel and 
282 @JDEV@.BR e2fsck (8)
283 @JDEV@do not currently support shared external journals yet.
284 @JDEV@.IP
285 @JDEV@Instead of specifying a device name directly,
286 @JDEV@.I external-journal
287 @JDEV@can also be specified by either
288 @JDEV@.BI LABEL= label
289 @JDEV@or
290 @JDEV@.BI UUID= UUID
291 @JDEV@to locate the external journal by either the volume label or UUID
292 @JDEV@stored in the ext2 superblock at the start of the journal.  Use
293 @JDEV@.BR dumpe2fs (8)
294 @JDEV@to display a journal device's volume label and UUID.  See also the
295 @JDEV@.B -L
296 @JDEV@option of
297 @JDEV@.BR tune2fs (8).
298 .RE
299 @JDEV@.IP
300 @JDEV@Only one of the
301 @JDEV@.BR size " or " device
302 @JDEV@options can be given for a filesystem.
303 .TP
304 .BI \-l " filename"
305 Read the bad blocks list from
306 .IR filename .  
307 Note that the block numbers in the bad block list must be generated
308 using the same block size as used by mke2fs.  As a result, the
309 .B \-c
310 option to 
311 .B mke2fs
312 is a much simpler and less error-prone method of checking a disk for bad
313 blocks before formatting it, as 
314 .B mke2fs
315 will automatically pass the correct parameters to the
316 .B badblocks
317 program.
318 .TP
319 .BI \-L " new-volume-label"
320 Set the volume label for the filesystem to
321 .IR new-volume-label .
322 The maximum length of the
323 volume label is 16 bytes.
324 .TP
325 .BI \-m " reserved-blocks-percentage"
326 Specify the percentage of the filesystem blocks reserved for 
327 the super-user.  This avoids fragmentation, and allows root-owned
328 daemons, such as 
329 .BR syslogd (8),
330 to continue to function correctly after non-privileged processes are 
331 prevented from writing to the filesystem.  The default percentage 
332 is 5%.
333 .TP
334 .B \-M
335 Set the last mounted directory for the filesystem.  This might be useful 
336 for the sake of utilities that key off of the last mounted directory to 
337 determine where the filesystem should be mounted.
338 .TP
339 .B \-n
340 causes mke2fs to not actually create a filesystem, but display what it
341 would do if it were to create a filesystem.  This can be used to
342 determine the location of the backup superblocks for a particular
343 filesystem, so long as the mke2fs parameters that were passed when the
344 filesystem was originally created are used again.  (With the
345 .B \-n 
346 option added, of course!)
347 .TP
348 .BI \-N " number-of-inodes"
349 overrides the default calculation of the number of inodes that should be 
350 reserved for the filesystem (which is based on the number of blocks and 
351 the 
352 .I bytes-per-inode
353 ratio).  This allows the user to specify the number 
354 of desired inodes directly.
355 .TP
356 .BI \-o " creator-os"
357 Manually override the default value of the "creator os" field of the 
358 filesystem.  Normally the creator field is set by default to the native OS
359 of the
360 .B mke2fs
361 executable.
362 .TP
363 .B "\-O \fIfeature\fR[,...]"
364 Create filesystem with given features (filesystem options), overriding 
365 the default filesystem options.  The default features which are 
366 enabled by default are specified by the
367 .I base_features
368 relation, either in the
369 .I [libdefaults]
370 section in the
371 .B /etc/mke2fs.conf
372 configuration file, or in the subsection of the 
373 .I [fs_types]
374 section for the filesystem type as specified by the
375 .B -T
376 option.  The filesystem type-specific configuration setting found in
377 the 
378 .I [fs_types]
379 section will override the global default found in
380 .IR [libdefaults] .
381 .sp
382 The filesystem feature set will be further edited 
383 using either the feature set specification specified by this option, 
384 or if this option is not specified, by the
385 .I default_features
386 relation for the filesystem type being created, or in the 
387 .I [libdefaults]
388 section of the configuration file.
389 .sp
390 The filesystem feature set is comprised of a list of features, separated
391 by commas, that are to be enabled.  To disable a feature, simply
392 prefix the feature name with a  caret ('^') character.  The 
393 pseudo-filesystem feature "none" will clear all filesystem features.
394 .RS 1.2i
395 .TP
396 .B dir_index
397 Use hashed b-trees to speed up lookups in large directories.
398 .TP
399 .B filetype
400 Store file type information in directory entries.
401 .TP
402 .B has_journal
403 Create an ext3 journal (as if using the
404 .B \-j
405 option).
406 @JDEV@.TP
407 @JDEV@.B journal_dev
408 @JDEV@Create an external ext3 journal on the given device
409 @JDEV@instead of a regular ext2 filesystem.
410 @JDEV@Note that
411 @JDEV@.I external-journal
412 @JDEV@must be created with the same
413 @JDEV@block size as the filesystems that will be using it.
414 .TP
415 .B resize_inode
416 Reserve space so the block group descriptor table may grow in the future.
417 Useful for online resizing using 
418 .BR resize2fs .
419 By default 
420 .B mke2fs
421 will attempt to reserve enough space so that the
422 filesystem may grow to 1024 times its initial size.  This can be changed
423 using
424 .B resize
425 extended option.
426 .TP
427 .B sparse_super
428 Create a filesystem with fewer superblock backup copies
429 (saves space on large filesystems).
430 .RE
431 .TP
432 .B \-q
433 Quiet execution.  Useful if 
434 .B mke2fs
435 is run in a script.
436 .TP
437 .BI \-r " revision"
438 Set the filesystem revision for the new filesystem.  Note that 1.2
439 kernels only support revision 0 filesystems.  The default is to 
440 create revision 1 filesystems.
441 .TP
442 .B \-S
443 Write superblock and group descriptors only.  This is useful if all of
444 the superblock and backup superblocks are corrupted, and a last-ditch
445 recovery method is desired.  It causes 
446 .B mke2fs
447 to reinitialize the 
448 superblock and group descriptors, while not touching the inode table
449 and the block and inode bitmaps.  The
450 .B e2fsck
451 program should be run immediately after this option is used, and there
452 is no guarantee that any data will be salvageable.  It is critical to
453 specify the correct filesystem blocksize when using this option,
454 or there is no chance of recovery.
455 .\" .TP
456 .\" .BI \-t " test"
457 .\" Check the device for bad blocks before creating the file system
458 .\" using the specified test.
459 .TP
460 .BI \-T " fs-type"
461 Specify how the filesystem is going to be used, so that 
462 .B mke2fs 
463 can choose optimal filesystem parameters for that use.  The filesystem
464 types that are can be supported are defined in the configuration file 
465 .BR /etc/mke2fs.conf (5).
466 The default configuration file contains definitions for the filesystem
467 types: small, floppy, news, largefile, and largefile4.  
468 .TP
469 .B \-v
470 Verbose execution.
471 .TP
472 .B \-V
473 Print the version number of 
474 .B mke2fs
475 and exit.
476 .SH AUTHOR
477 This version of
478 .B mke2fs
479 has been written by Theodore Ts'o <tytso@mit.edu>.
480 .SH BUGS
481 .B mke2fs
482 accepts the
483 .B \-f
484 option but currently ignores it because the second
485 extended file system does not support fragments yet.
486 .br
487 There may be other ones.  Please, report them to the author.
488 .SH AVAILABILITY
489 .B mke2fs
490 is part of the e2fsprogs package and is available from 
491 http://e2fsprogs.sourceforge.net.
492 .SH SEE ALSO
493 .BR mke2fs.conf (5),
494 .BR badblocks (8),
495 .BR dumpe2fs (8),
496 .BR e2fsck (8),
497 .BR tune2fs (8)