Debian Codegraph @

upstream/debian-unstable/man8/mke2fs.8

raw
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 "March 2025" "E2fsprogs version 1.47.4"
6 .SH NAME
7 mke2fs \- create an ext2/ext3/ext4 file system
8 .SH SYNOPSIS
9 .B mke2fs
10 [
11 .B \-c
12 |
13 .BI \-l " filename"
14 ]
15 [
16 .BI \-b " block-size"
17 ]
18 [
19 .BI \-C " cluster-size"
20 ]
21 [
22 .B \-d\fR \fIroot-directory\fR|\fItarball\fR|\fI-\fR
23 ]
24 [
25 .B \-D
26 ]
27 [
28 .BI \-g " blocks-per-group"
29 ]
30 [
31 .BI \-G " number-of-groups"
32 ]
33 [
34 .BI \-i " bytes-per-inode"
35 ]
36 [
37 .BI \-I " inode-size"
38 ]
39 [
40 .B \-j
41 ]
42 [
43 .BI \-J " journal-options"
44 ]
45 [
46 .BI \-N " number-of-inodes"
47 ]
48 [
49 .B \-n
50 ]
51 [
52 .BI \-m " reserved-blocks-percentage"
53 ]
54 [
55 .BI \-o " creator-os"
56 ]
57 [
58 .B \-O\fR [^]\fIfeature\fR[,...]
59 ]
60 [
61 .B \-q
62 ]
63 [
64 .BI \-E " extended-options"
65 ]
66 [
67 .B \-v
68 ]
69 [
70 .B \-F
71 ]
72 [
73 .BI \-L " volume-label"
74 ]
75 [
76 .BI \-M " last-mounted-directory"
77 ]
78 [
79 .B \-S
80 ]
81 [
82 .BI \-t " fs-type"
83 ]
84 [
85 .BI \-T " usage-type"
86 ]
87 [
88 .BI \-U " UUID"
89 ]
90 [
91 .B \-V
92 ]
93 [
94 .BI \-e " errors-behavior"
95 ]
96 [
97 .BI \-z " undo_file"
98 ]
99 .I device
100 [
101 .I fs-size
102 ]
103 .sp
104 .B "mke2fs \-O journal_dev"
105 [
106 .BI \-b " block-size"
107 ]
108 .\" No external-journal specific journal options yet (size is ignored)
109 .\" [
110 .\" .B \-J
111 .\" .I journal-options
112 .\" ]
113 [
114 .BI \-L " volume-label"
115 ]
116 [
117 .B \-n
118 ]
119 [
120 .B \-q
121 ]
122 [
123 .B \-v
124 ]
125 .I external-journal
126 [
127 .I fs-size
128 ]
129 .SH DESCRIPTION
130 .B mke2fs
131 is used to create an ext2, ext3, or ext4 file system, usually in a disk
132 partition (or file) named by \fIdevice\fR.
133 .PP
134 The file system size is specified by \fIfs-size\FR. If \fIfs-size\fR
135 does not have a suffix, it is interpreted as power-of-two kilobytes,
136 unless the \fB\-b\fR \fIblock-size\fR
137 option is specified, in which case \fIfs-size\fR is interpreted as the number of
138 \fIblock-size\fR blocks. If the \fIfs-size\fR is suffixed by 'k', 'm', 'g', 't'
139 (either upper-case or lower-case), then it is interpreted in
140 power-of-two kilobytes, megabytes, gigabytes, terabytes, etc.
141 If \fIfs-size\fR is omitted, \fBmke2fs\fR
142 will create the file system based on the device size.
143 .PP
144 If \fBmke2fs\fR is run as \fBmkfs.XXX\fR
145 (i.e., \fBmkfs.ext2\fR, \fBmkfs.ext3\fR, or \fBmkfs.ext4\fR) the option
146 \fB\-t\fR \fIXXX\fR
147 is implied; so \fBmkfs.ext3\fR will create a file system for use with ext3,
148 \fBmkfs.ext4\fR will create a file system for use with ext4, and so on.
149 .PP
150 The defaults of the parameters for the newly created file system, if not
151 overridden by the options listed below, are controlled by the
152 \fB/etc/mke2fs.conf\fR configuration file. See the \fBmke2fs.conf\fR(5) manual
153 page for more details.
154 .SH OPTIONS
155 .TP
156 .BI \-b " block-size"
157 Specify the size of blocks in bytes. Valid \fIblock-size\fR values are powers
158 of two from 1024 up to 65536 (however note that the kernel is able to mount only
159 file systems with \fIblock-size\fR smaller or equal to the system page size - 4k
160 on x86 systems, up to 64k on ppc64 or aarch64 depending on kernel configuration).
161 If omitted, \fIblock-size\fR is heuristically determined by the file system size
162 and the expected usage of the file system (see the \fB\-T\fR option). In most
163 common cases, the default block size is 4k. If \fIblock-size\fR is preceded by a
164 negative sign ('-'), then \fBmke2fs\fR will use heuristics to determine the
165 appropriate block size, with the constraint that the block size will be at least
166 \fIblock-size\fR bytes. This is useful for certain hardware devices which require
167 that the blocksize be a multiple of 2k.
168 .TP
169 .B \-c
170 Check the device for bad blocks before creating the file system. If
171 this option is specified twice, then a slower read-write
172 test is used instead of a fast read-only test.
173 .TP
174 .BI \-C " cluster-size"
175 Specify the size of clusters in bytes for file systems using the \fBbigalloc\fR
176 feature. Valid \fIcluster-size\fR values range from 2 to 32768 times the
177 filesystem block size and must be a power of 2. The \fIcluster-size\fR can
178 only be specified if the \fBbigalloc\fR feature is enabled. (See the
179 \fBext4\fR(5) man page for more details about \fBbigalloc\fR.) The
180 default cluster size if \fBbigalloc\fR is enabled is 16 times the block size.
181 .TP
182 .B \-d\fR \fIroot-directory\fR|\fItarball\fR|\fI-\fR
183 Copy the contents of the given directory or tarball into the root directory of the
184 file system. Tarball input is only available if \fBmke2fs\fR was compiled with
185 libarchive support enabled and if the libarchive shared library is available
186 at run-time. The special value "\fB-\fR" will read a tarball from standard input.
187 .TP
188 .B \-D
189 Use direct I/O when writing to the disk. This avoids \fBmke2fs\fR dirtying a
190 lot of buffer cache memory, which may impact other applications running
191 on a busy server. This option will cause \fBmke2fs\fR to run much more
192 slowly, however, so there is a tradeoff to using direct I/O.
193 .TP
194 .BI \-e " error-behavior"
195 Change the behavior of the kernel code when errors are detected.
196 In all cases, a file system error will cause \fBe2fsck\fR(8)
197 to check the file system on the next boot. \fIerror-behavior\fR
198 can be one of the following:
199 .RS 1.2i
200 .TP 1.2i
201 .B continue
202 Continue normal execution.
203 .TP
204 .B remount-ro
205 Remount file system read-only.
206 .TP
207 .B panic
208 Cause a kernel panic.
209 .RE
210 .TP
211 .BI \-E " extended-options"
212 Set extended options for the file system. Extended options are comma
213 separated, and may take an argument using the equals ('=') sign. Multiple
214 \fB\-E\fR options may also be used. The \fB\-E\fR option used to be \fB\-R\fR
215 in earlier versions of \fBmke2fs\fR. The \fB\-R\fR
216 option is still accepted for backwards compatibility, but is deprecated.
217 The following extended options are supported:
218 .RS 1.2i
219 .TP
220 .BR assume_storage_prezeroed [ = < 0 " to disable | " 1 " to enable>]
221 If enabled, \fBmke2fs\fR
222 assumes that the storage device has been prezeroed, skips zeroing the journal
223 and inode tables, and annotates the block group flags to signal that the inode
224 table has been zeroed.
225 .TP
226 .B discard
227 Attempt to discard blocks at mkfs time (discarding blocks initially is useful
228 on solid state devices and sparse / thin-provisioned storage). When the device
229 advertises that discard also zeroes data (any subsequent read after the discard
230 and before write returns zero), then mark all not-yet-zeroed inode tables as
231 zeroed. This significantly speeds up file system initialization. This is set
232 as default.
233 .TP
234 .BI encoding= encoding-name
235 Enable the \fBcasefold\fR feature in the super block and set \fIencoding-name\fR
236 as the encoding to be used. If \fIencoding-name\fR is not specified, the
237 encoding defined in \fBmke2fs.conf\fR(5) is used.
238 .TP
239 .BI encoding_flags= encoding-flags
240 Define parameters for file name character encoding operations. If a
241 flag is not changed using this parameter, its default value is used.
242 \fIencoding-flags\fR should be a comma-separated lists of flags to be enabled.
243 To disable a flag, add it to the list with the prefix "no".
244
245 The only flag that can be set right now is \fIstrict\fR
246 which means that invalid strings should be rejected by the file system.
247 In the default configuration, the \fIstrict\fR flag is disabled.
248 .TP
249 .BI hash_seed= UUID
250 Use the specified UUID as the seed for hashing, rather than generating a
251 random seed each time. Intended for use with reproducible builds.
252 .TP
253 .BR lazy_itable_init [ = < 0 " to disable | " 1 " to enable>]
254 If enabled and the \fBuninit_bg\fR feature is enabled, the inode table will
255 not be fully initialized by \fBmke2fs\fR. This speeds up file system
256 initialization noticeably, but it requires the kernel to finish
257 initializing the file system in the background when the file system is
258 first mounted. If the option value is omitted, it defaults to 1 to
259 enable lazy inode table zeroing.
260 .TP
261 .BR lazy_journal_init [ = < 0 " to disable | " 1 " to enable>]
262 If enabled, the journal inode will not be fully zeroed out by \fBmke2fs\fR.
263 This speeds up file system initialization noticeably, but carries some
264 small risk if the system crashes before the journal has been overwritten
265 entirely one time. If the option value is omitted, it defaults to 1 to
266 enable lazy journal inode zeroing.
267 .TP
268 .BI mmp_update_interval= interval
269 Adjust the initial MMP update interval to \fIinterval\fR
270 seconds. Specifying an \fIinterval\fR
271 of 0 means to use the default interval. The specified interval must
272 be less than 300 seconds. Requires that the \fBmmp\fR feature be enabled.
273 .TP
274 .B nodiscard
275 Do not attempt to discard blocks at mkfs time.
276 .TP
277 .B no_copy_xattrs
278 Normally \fBmke2fs\fR
279 will copy the extended attributes of the files in the directory
280 hierarchy specified via the (optional) \fB\-d\fR
281 option. This will disable the copy and leaves the files in the newly
282 created file system without any extended attributes.
283 .TP
284 .BR num_backup_sb= < 0 | 1 | 2 >
285 If the \fBsparse_super2\fR
286 file system feature is enabled this option controls whether there will
287 be 0, 1, or 2 backup superblocks created in the file system.
288 .TP
289 .BI offset= offset
290 Create the file system at an offset from the beginning of the device or
291 file. This can be useful when creating disk images for virtual machines.
292 .TP
293 .BI orphan_file_size= size
294 Set size of the file for tracking unlinked but still open inodes and inodes
295 with truncate in progress. Larger file allows for better scalability, reserving
296 a few blocks per CPU is ideal.
297 .TP
298 .BR packed_meta_blocks [ = < 0 " to disable | " 1 " to enable>]
299 Place the allocation bitmaps and the inode table at the beginning of the
300 disk. This option requires that the \fBflex_bg\fR file system feature to be
301 enabled in order for it to have effect, and will also create the journal
302 at the beginning of the file system. This option is useful for flash
303 devices that use SLC flash at the beginning of the disk.
304 It also maximizes the range of contiguous data blocks, which
305 can be useful for certain specialized use cases, such as supported
306 Shingled Drives.
307 .TP
308 .B quotatype=\fIquota-type\fR[:...]
309 Specify the which quota types (\fIusrquota\fR, \fIgrpquota\fR, \fIprjquota\fR)
310 which should be enabled in the created file system. The argument of this
311 extended option should be a colon separated list. This option has
312 effect only if the \fBquota\fR
313 feature is set. The default quota types to be initialized if this
314 option is not specified is both user and group quotas. If the \fBproject\fR
315 feature is enabled then the project quotas will be initialized as well.
316 .TP
317 .BI resize= max-online-resize
318 Reserve enough space so that the block group descriptor table can grow
319 to support a file system that has \fImax-online-resize\fR blocks.
320 .TP
321 .BI revision= fs-revision
322 Specify the file system revision number. Revision 0 file systems
323 provide compatibility with pre-1.2 Linux kernels (dating from before
324 1995). This is only needed for testing or people who want to use
325 very early, historical Linux systems. The current default (supported
326 by all modern Linux systems) is revision 1.
327 .TP
328 .B root_owner\fR[\fB=\fIuid:gid\fR]
329 Specify the numeric user and group ID of the root directory. If no UID:GID
330 is specified, use the user and group ID of the user running \fBmke2fs\fR.
331 In \fBmke2fs\fR 1.42 and earlier the UID and GID of the root directory were
332 set by default to the UID and GID of the user running the mke2fs command.
333 The \fBroot_owner=\fR option allows explicitly specifying these values,
334 and avoid side-effects for users that do not expect the contents of the
335 file system to change based on the user running \fBmke2fs\fR.
336 .TP
337 .B root_perms\fR[\fB=\fIpermissions\fR]
338 Specify the root directory permissions in octal format. If no permissions
339 are specified then the root directory permissions would be set in accordance with
340 the default filesystem umask.
341 .TP
342 .BI root_selinux= label
343 Specify the root directory SELinux security context as \fIlabel\fR,
344 typically
345 .nh
346 \fBsystem_u:object_r:root_t\fR with an optional level/range suffix such as
347 \fB:s0\fR for MCS/MLS policy types.
348 .TP
349 .BI stride= stride-size
350 Configure the file system for a RAID array with \fIstride-size\fR
351 file system blocks. This is the number of blocks read or written to disk
352 before moving to the next disk, which is sometimes referred to as the
353 .IR "chunk size" .
354 This mostly affects placement of file system metadata like bitmaps at \fBmke2fs\fR
355 time to avoid placing them on a single disk, which can hurt performance.
356 It may also be used by the block allocator.
357 .TP
358 .BI stripe_width= stripe-width
359 Configure the file system for a RAID array with \fIstripe-width\fR
360 file system blocks per stripe. This is typically \fIstride-size\fR * N, where
361 N is the number of data-bearing disks in the RAID (e.g. for RAID 5 there is one
362 parity disk, so N will be the number of disks in the array minus 1).
363 This allows the block allocator to prevent read-modify-write of the
364 parity in a RAID stripe if possible when the data is written.
365 .TP
366 .B test_fs
367 Set a flag in the file system superblock indicating that it may be
368 mounted using experimental kernel code, such as the ext4dev file system.
369 .RE
370 .TP
371 .B \-F
372 Force \fBmke2fs\fR
373 to create a file system, even if the specified device is not a partition
374 on a block special device, or if other parameters do not make sense.
375 In order to force \fBmke2fs\fR
376 to create a file system even if the file system appears to be in use
377 or is mounted (a truly dangerous thing to do), this option must be
378 specified twice.
379 .TP
380 .BI \-g " blocks-per-group"
381 Specify the number of blocks in a block group. There is generally no
382 reason for the user to ever set this parameter, as the default is optimal
383 for the file system. (For administrators who are creating
384 file systems on RAID arrays, it is preferable to use the \fB \-E stride=\fR
385 extended option rather than manipulating the number of blocks per group.)
386 This option is generally used by developers who are developing test cases.
387 .IP
388 If the \fBbigalloc\fR feature is enabled, the \fB\-g\fR
389 option will specify the number of clusters in a block group.
390 .TP
391 .BI \-G " number-of-groups"
392 Specify the number of block groups that will be packed together to
393 create a larger virtual block group (or "flex_bg group") in an
394 ext4 file system. This improves meta-data locality and performance
395 on meta-data heavy workloads. The number of groups must be a power
396 of 2 and may only be specified if the \fBflex_bg\fR
397 file system feature is enabled.
398 .TP
399 .BI \-i " bytes-per-inode"
400 Specify the bytes/inode ratio.
401 \fBmke2fs\fR creates an inode for every \fIbytes-per-inode\fR
402 bytes of space on the disk. The larger the \fIbytes-per-inode\fR
403 ratio, the fewer inodes will be created. This value generally shouldn't
404 be smaller than the \fIblock-size\fR of the file system, since in that case more
405 inodes would be made than can ever be used. Be warned that it is not
406 possible to change this ratio on a file system after it is created, so be
407 careful deciding the correct value for this parameter. Note that resizing
408 a file system changes the number of inodes to maintain this ratio.
409 .TP
410 .BI \-I " inode-size"
411 Specify the size of each inode in bytes.
412 The \fIinode-size\fR
413 value must be a power of 2 larger or equal to 128. The larger the
414 \fIinode-size\fR
415 the more space the inode table will consume, and this reduces the usable
416 space in the file system and can also negatively impact performance.
417 It is not possible to change this value after the file system is created.
418 .IP
419 File systems with an inode size of 128 bytes do not support timestamps
420 beyond January 19, 2038. Inodes which are 256 bytes or larger will
421 support extended timestamps, project id's, and the ability to store some
422 extended attributes in the inode table for improved performance.
423 .IP
424 The default inode size is controlled by the
425 \fBmke2fs.conf\fR(5) file. In the \fBmke2fs.conf\fR
426 file shipped with e2fsprogs, the default inode size is 256 bytes for
427 all file systems, except for the GNU Hurd since it only supports
428 128-byte inodes.
429 .TP
430 .B \-j
431 Create the file system with an ext3 journal. If the \fB\-J\fR
432 option is not specified, the default journal parameters will be used to
433 create an appropriately sized journal (given the size of the file system)
434 stored within the file system. Note that you must be using a kernel
435 which has ext3 support in order to actually make use of the journal.
436 .TP
437 .BI \-J " journal-options"
438 Create the ext3 journal using options specified on the command-line.
439 Journal options are comma
440 separated, and may take an argument using the equals ('=') sign.
441 The following journal options are supported:
442 .RS 1.2i
443 .TP
444 .BI device= external-journal
445 Attach the file system to the journal block device located on
446 .IR external-journal .
447 The external journal must already have been created using the command
448 .IP
449 .B mke2fs -O journal_dev\fR \fIexternal-journal\fR
450 .IP
451 Note that \fIexternal-journal\fR must have been created with the
452 same block size as the new file system.
453 In addition, while there is support for attaching
454 multiple file systems to a single external journal,
455 the Linux kernel and \fBe2fsck\fR(8)
456 do not currently support shared external journals yet.
457 .IP
458 Instead of specifying a device name directly, \fIexternal-journal\fR
459 can also be specified by either \fBLABEL=\fIlabel\fR or \fBUUID=\fIUUID\fR
460 to locate the external journal by either the volume label or UUID
461 stored in the ext2 superblock at the start of the journal. Use
462 .BR dumpe2fs (8)
463 to display a journal device's volume label and UUID. See also the
464 \fB\-L\fR option of \fBtune2fs\fR(8).
465 .TP
466 .BI fast_commit_size= fast-commit-size
467 Create an additional fast commit journal area of size \fIfast-commit-size\fR
468 kilobytes.
469 This option is only valid if the \fBfast_commit\fR feature is enabled
470 on the file system. If this option is not specified and if the \fBfast_commit\fR
471 feature is turned on, fast commit area size defaults to \fIjournal-size\fR
472 / 64 megabytes. The total size of the journal with \fBfast_commit\fR feature set
473 is \fIjournal-size\fR + ( \fIfast-commit-size\fR * 1024 ) megabytes.
474 The total journal size may be no more than
475 10,240,000 file system blocks or half the total file system size
476 (whichever is smaller).
477 .TP
478 .BI location= journal-location
479 Specify the location of the journal. The argument \fIjournal-location\fR
480 can either be specified as a block number, or if the number has a units
481 suffix (e.g., 'M', 'G', etc.) interpret it as the offset from the
482 beginning of the file system.
483 .TP
484 .BI size= journal-size
485 Create an internal journal (i.e., stored inside the file system) of size
486 \fIjournal-size\fR megabytes.
487 The size of the journal must be at least 1024 file system blocks
488 (i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.)
489 and may be no more than 10,240,000 file system blocks or half the total
490 file system size (whichever is smaller)
491 .RE
492 .IP
493 Only one of the \fBsize\fR or \fBdevice\fR
494 options can be given for a file system.
495 .TP
496 .BI \-l " filename"
497 Read the bad blocks list from \fIfilename\fR.
498 Note that the block numbers in the bad block list must be generated
499 using the same block size as used by \fBmke2fs\fR.
500 As a result, the \fB\-c\fR option to \fBmke2fs\fR
501 is a much simpler and less error-prone method of checking a disk for bad
502 blocks before formatting it, as \fBmke2fs\fR
503 will automatically pass the correct parameters to the \fBbadblocks\fR(8) program.
504 .TP
505 .BI \-L " new-volume-label"
506 Set the volume label for the file system to \fInew-volume-label\fR.
507 The maximum length of the volume label is 16 bytes.
508 .TP
509 .BI \-m " reserved-blocks-percentage"
510 Specify the percentage of the file system blocks reserved for
511 the super-user. This avoids fragmentation, and allows root-owned
512 daemons, such as \fBsyslogd\fR(8),
513 to continue to function correctly after non-privileged processes are
514 prevented from writing to the file system. The default percentage
515 is 5%.
516 .TP
517 .BI \-M " last-mounted-directory"
518 Set the last mounted directory for the file system. This might be useful
519 for the sake of utilities that key off of the last mounted directory to
520 determine where the file system should be mounted.
521 .TP
522 .B \-n
523 Causes \fBmke2fs\fR to not actually create a file system, but display what it
524 would do if it were to create a file system. This can be used to
525 determine the location of the backup superblocks for a particular
526 file system, so long as the \fBmke2fs\fR parameters that were passed when the
527 file system was originally created are used again. (With the \fB\-n\fR
528 option added, of course!)
529 .TP
530 .BI \-N " number-of-inodes"
531 Overrides the default calculation of the number of inodes that should be
532 reserved for the file system (which is based on the number of blocks and
533 the \fIbytes-per-inode\fR ratio). This allows the user to specify the number
534 of desired inodes directly.
535 .TP
536 .BI \-o " creator-os"
537 Overrides the default value of the "creator operating system" field of the
538 file system. The creator field is set by default to the name of the OS the
539 \fBmke2fs\fR executable was compiled for.
540 .TP
541 .B "\-O \fR[^]\fIfeature\fR[,...]"
542 Create a file system with the given features (file system options),
543 overriding the default file system options. The features that are
544 enabled by default are specified by the \fIbase_features\fR
545 relation, either in the \fI[defaults]\fR section in the \fB/etc/mke2fs.conf\fR
546 configuration file, or in the \fI[fs_types]\fR
547 subsections for the usage types as specified by the
548 \fB\-T\fR option, further modified by the \fIfeatures\fR relation found in the
549 \fI[fs_types]\fR subsections for the file system and usage types. See the
550 \fBmke2fs.conf\fR(5) manual page for more details.
551 The file system type-specific configuration setting found in the
552 \fI[fs_types]\fR section will override the global default found in
553 \fI[defaults]\fR.
554 .sp
555 The file system feature set will be further edited
556 using either the feature set specified by this option,
557 or if this option is not given, by the \fIdefault_features\fR
558 relation for the file system type being created, or in the \fI[defaults]\fR
559 section of the configuration file.
560 .sp
561 The file system feature set is comprised of a list of features, separated
562 by commas, that are to be enabled. To disable a feature, simply
563 prefix the feature name with a caret ('^') character.
564 Features with dependencies will not be removed successfully.
565 The pseudo-file system feature "\fBnone\fR" will clear all file system features.
566 .sp
567 For more information about the features which can be set, please see
568 the manual page \fBext4\fR(5).
569 .TP
570 .B \-q
571 Quiet execution. Useful if \fBmke2fs\fR is run in a script.
572 .TP
573 .B \-S
574 Write superblock and group descriptors only. This is an extreme
575 measure to be taken only in the very unlikely case that all of
576 the superblock and backup superblocks are corrupted, and a last-ditch
577 recovery method is desired by experienced users. It causes \fBmke2fs\fR
578 to reinitialize the superblock and group descriptors, while not
579 touching the inode table and the block and inode bitmaps. The \fBe2fsck\fR(8)
580 program should be run immediately after this option is used, and there
581 is no guarantee that any data will be salvageable.
582 .sp
583 Due to the wide variety of possible options to \fBmke2fs\fR that affect the
584 on-disk layout, it is critical to specify exactly the same format options, such
585 as \fIblock-size\fR, \fIfs-type\fR, feature flags, and
586 other tunables when using this option, or the file system will be further
587 corrupted. In some cases, such as file systems that have been resized,
588 or have had features enabled after format time, it is impossible to
589 overwrite all of the superblocks correctly, and at least some file system
590 corruption will occur. It is best to run this on a full copy of the
591 file system so other options can be tried if this doesn't work.
592 .\" .TP
593 .\" .BI \-t " test"
594 .\" Check the device for bad blocks before creating the file system
595 .\" using the specified test.
596 .TP
597 .BI \-t " fs-type"
598 Specify the file system type (i.e., ext2, ext3, ext4, etc.) that is
599 to be created.
600 If this option is not specified, \fBmke2fs\fR will pick a default either via how
601 the command was run (for example, using a name of the form \fBmkfs.ext2\fR,
602 \fBmkfs.ext3\fR, etc.) or via a default as defined by the \fB/etc/mke2fs.conf\fR
603 file. This option controls which file system options are used by
604 default, based on the \fI[fs_types]\fR configuration stanza in
605 \fB/etc/mke2fs.conf\fR.
606 .sp
607 If the \fB\-O\fR
608 option is used to explicitly add or remove file system options that
609 should be set in the newly created file system, the
610 resulting file system may not be supported by the requested \fIfs-type\fR.
611 (e.g., "\fBmke2fs \-t ext3 \-O extent /dev/sdXX\fR" will create a
612 file system that is not supported by the ext3 implementation as found in
613 the Linux kernel; and "\fBmke2fs \-t ext3 \-O ^has_journal /dev/hdXX\fR"
614 will create a file system that does not have a journal and hence will not
615 be supported by the ext3 file system code in the Linux kernel.)
616 .TP
617 .BI \-T " usage-type[,...]"
618 Specify how the file system is going to be used, so that \fBmke2fs\fR
619 can choose optimal file system parameters for that use. The usage
620 types that are supported are defined in the configuration file
621 \fB/etc/mke2fs.conf\fR(5).
622 The user may specify one or more usage types using a comma separated list.
623 .sp
624 If this option is is not specified, \fBmke2fs\fR
625 will pick a single default usage type based on the size of the file system to
626 be created. If the file system size is less than 3 megabytes,
627 \fBmke2fs\fR will use the file system type \fIfloppy\fR.
628 If the file system size is greater than or equal to 3 but less than
629 512 megabytes, \fBmke2fs\fR will use the file system type \fIsmall\fR.
630 If the file system size is greater than or equal to 4 terabytes but less than
631 16 terabytes, \fBmke2fs\fR will use the file system type \fIbig\fR.
632 If the file system size is greater than or equal to 16 terabytes,
633 \fBmke2fs\fR will use the file system type \fIhuge\fR.
634 Otherwise, \fBmke2fs\fR will use the default file system type \fIdefault\fR.
635 .TP
636 .BI \-U " UUID"
637 Set the universally unique identifier (UUID) of the file system to \fIUUID\fR.
638 The format of the UUID is a series of hex digits separated by hyphens,
639 like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16".
640 The \fIUUID\fR parameter may also be one of the following:
641 .RS 1.2i
642 .TP
643 .B clear
644 clear the file system UUID
645 .TP
646 .B random
647 generate a new randomly-generated UUID
648 .TP
649 .B time
650 generate a new time-based UUID
651 .RE
652 .TP
653 .B \-v
654 Verbose execution.
655 .TP
656 .B \-V
657 Print the version number of \fBmke2fs\fR and exit.
658 .TP
659 .BI \-z " undo_file"
660 Before overwriting a file system block, write the old contents of the block to
661 an undo file. This undo file can be used with \fBe2undo\fR(8) to restore the old
662 contents of the file system should something go wrong. If the empty string is
663 passed as the undo_file argument, the undo file will be written to a file named
664 mke2fs-\fIdevice\fR.e2undo in the directory specified via the
665 \fBE2FSPROGS_UNDO_DIR\fR environment variable or the \fIundo_dir\fR directive
666 in the configuration file.
667 .sp
668 .B WARNING:
669 The undo file cannot be used to recover from a power or system crash.
670 .SH ENVIRONMENT
671 .TP
672 .B MKE2FS_SYNC
673 If set to non-zero integer value, its value is used to determine how often
674 \fBsync\fR(2) is called during inode table initialization.
675 .TP
676 .B MKE2FS_CONFIG
677 Determines the location of the configuration file (see \fBmke2fs.conf\fR(5)).
678 .TP
679 .B MKE2FS_FIRST_META_BG
680 If set to non-zero integer value, its value is used to determine first meta
681 block group. This is mostly for debugging purposes.
682 .TP
683 .B MKE2FS_DEVICE_SECTSIZE
684 If set to non-zero integer value, its value is used to determine logical
685 sector size of the \fIdevice\fR.
686 .TP
687 .B MKE2FS_DEVICE_PHYS_SECTSIZE
688 If set to non-zero integer value, its value is used to determine physical
689 sector size of the \fIdevice\fR.
690 .TP
691 .B MKE2FS_SKIP_CHECK_MSG
692 If set, do not show the message of file system automatic check caused by
693 mount count or check interval.
694 .SH AUTHOR
695 This version of \fBmke2fs\fR has been written by Theodore Ts'o <[email protected]>.
696 .SH AVAILABILITY
697 \fBmke2fs\fR is part of the e2fsprogs package and is available from
698 http://e2fsprogs.sourceforge.net.
699 .SH SEE ALSO
700 .BR mke2fs.conf (5),
701 .BR badblocks (8),
702 .BR dumpe2fs (8),
703 .BR e2fsck (8),
704 .BR tune2fs (8),
705 .BR ext4 (5)