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