mke2fs.conf(5)

๐Ÿ’– mke2fs.conf โ€” the manual, but make it make sense ๐Ÿ’–

okay bestie, so this is mke2fs.conf(5), aka the File Formats Manual page for the config file that runs the whole show behind mke2fs(8). it's giving โœจthe blueprintโœจ. let's get into it.


๐ŸŒธ NAME ๐ŸŒธ

mke2fs.conf โ€” configuration file for mke2fs


๐ŸŽ€ DESCRIPTION ๐ŸŽ€

okay so mke2fs.conf is the configuration file for mke2fs(8). no cap. it controls the default parameters that mke2fs(8) uses when it's out here creating ext2, ext3, or ext4 file systems. main character energy fr fr ๐Ÿ’…

the mke2fs.conf file uses an INI-style format. Stanzas (that's the fancy word for top-level sections, iykyk) are delimited by square braces: [ ]. inside each section, every line defines a relation, which assigns tags to values, or to a subsection โ€” and a subsection contains further relations or subsections. here's an example of the INI-style format this config file uses, below:

[section1]
     tag1 = value_a
     tag1 = value_b
     tag2 = value_c

[section 2]
     tag3 = {
          subtag1 = subtag_value_a
          subtag1 = subtag_value_b
          subtag2 = subtag_value_c
     }
     tag1 = value_d
     tag2 = value_e
}
heads up: that trailing } at the end is literally in the original. don't @ me, i just work here ๐Ÿซถ

comments are delimited by a semicolon (;) or a hash (#) character at the beginning of the comment, and they're terminated by the end-of-line character. periodt.

tags and values must be quoted using double quotes if they contain spaces. within a quoted string, the standard backslash interpretations apply: "\n" (for the newline character), "\t" (for the tab character), "\b" (for the backspace character), and "\\" (for the backslash character). ๐Ÿ’…

some relations expect a boolean value. the parser is quite liberal on recognizing yes'', '`y'', true'', t'', 1'', on'', etc. as a boolean true value, and no'', n'', false'', nil'', 0'', ``off'' as a boolean false value. so like. it's flexible. it ate and left no crumbs ๐Ÿ’€

the following stanzas are used in the mke2fs.conf file. they will be described in more detail in future sections of this document. ๐Ÿ‘‘

  • [options] โ€” contains relations which influence how mke2fs(8) behaves.
  • [defaults] โ€” contains relations which define the default parameters used by mke2fs(8). in general, these defaults may be overridden by a definition in the [fs_types] stanza, or by a command-line option provided by the user.
  • [fs_types] โ€” contains relations which define defaults that should be used for specific file system and usage types. the file system type and usage type can be specified explicitly using the -t and -T options to mke2fs(8), respectively.
  • [devices] โ€” contains relations which define defaults for specific devices.

โœจ THE [options] STANZA โœจ

the following relations are defined in the [options] stanza.

  • proceed_delay โ€” if this relation is set to a positive integer, then mke2fs(8) will wait proceed_delay seconds after asking the user for permission to proceed and then continue, even if the user has not answered the question. defaults to 0, which means to wait until the user answers the question one way or another. ๐Ÿ˜ญ
  • sync_kludge โ€” if this relation is set to a positive integer, then while writing the inode table, mke2fs(8) will request the operating system flush out pending writes to initialize the inode table every sync_kludge block groups. this is needed to work around buggy kernels that don't handle writeback throttling correctly. ๐Ÿ’€

๐ŸŒˆ THE [defaults] STANZA ๐ŸŒˆ

the following relations are defined in the [defaults] stanza.

  • creator_os โ€” this relation specifies the "creator operating system" for the file system unless it is overridden on the command line. the default value is the OS for which the mke2fs(8) executable was compiled. ๐Ÿงš
  • fs_type โ€” this relation specifies the default file system type if the user does not specify it via the -t option, or if mke2fs(8) is not started using a program name of the form mkfs.fs-type. if both the user and the mke2fs.conf file do not specify a default file system type, mke2fs will use a default file system type of ext3 if a journal was requested via a command-line option, or ext2 if not.
  • undo_dir โ€” this relation specifies the directory where the undo file should be stored. it can be overridden via the E2FSPROGS_UNDO_DIR environment variable. if the directory location is set to the value none, mke2fs(8) will not create an undo file.

in addition, any tags that can be specified in a per-file system tags subsection as defined below (e.g., blocksize, hash_alg, inode_ratio, inode_size, reserved_ratio, etc.) can also be specified in the defaults stanza to specify the default value to be used if the user does not specify one on the command line, and the file system-type specific section of the configuration file does not specify a default value. ๐ŸŽ€


๐Ÿฆ‹ THE [fs_types] STANZA ๐Ÿฆ‹

each tag in the [fs_types] stanza names a file system type or usage type which can be specified via the -t or -T options to mke2fs(8), respectively.

the mke2fs(8) program constructs a list of fs_types by concatenating the file system type (i.e., ext2, ext3, etc.) with the usage type list. for most configuration options, mke2fs(8) will look for a subsection in the [fs_types] stanza corresponding with each entry in the constructed list, with later entries overriding earlier file system or usage types. for example, consider the following mke2fs.conf fragment:

[defaults]
     base_features = sparse_super,filetype,resize_inode,dir_index
     blocksize = 4096
     inode_size = 256
     inode_ratio = 16384

[fs_types]
     ext3 = {
          features = has_journal
     }
     ext4 = {
          features = extents,flex_bg
          inode_size = 256
     }
     small = {
          blocksize = 1024
          inode_ratio = 4096
     }
     floppy = {
          features = ^resize_inode
          blocksize = 1024
          inode_size = 128
     }

if mke2fs started with a program name of mke2fs.ext4, then the file system type of ext4 will be used. if the file system is smaller than 3 megabytes, and no usage type is specified, then mke2fs will use a default usage type of floppy. this results in an fs_types list of "ext4, floppy". both the ext4 subsection and the floppy subsection define an inode_size relation, but since the later entries in the [fs_types] list supersede earlier ones, the configuration parameter for fs_types.floppy.inode_size will be used, so the file system will have an inode size of 128. ๐Ÿ”ฅ

the exception to this resolution is the features tag, which specifies a set of changes to the features used by the file system, and which is cumulative. so in the above example, first the configuration relation defaults.base_features would enable an initial feature set with the sparse_super, filetype, resize_inode, and dir_index features enabled. then configuration relation fs_types.ext4.features would enable the extents and flex_bg features, and finally the configuration relation fs_types.floppy.features would remove the resize_inode feature, resulting in a file system feature set consisting of the sparse_super, filetype, dir_index, extents and flex_bg features. slay ๐Ÿ’…

for each file system type, the following tags may be used in that fs_type's subsection. these tags may also be used in the default section:

  • base_features โ€” this relation specifies the features which are initially enabled for this file system type. only one base_features will be used, so if there are multiple entries in the fs_types list whose subsections define the base_features relation, only the last will be used by mke2fs(8).
  • enable_periodic_fsck โ€” this boolean relation specifies whether periodic file system checks should be enforced at boot time. if set to true, checks will be forced every 180 days, or after a random number of mounts. these values may be changed later via the -i and -c command-line options to tune2fs(8).
  • errors โ€” change the behavior of the kernel code when errors are detected. in all cases, a file system error will cause e2fsck(8) to check the file system on the next boot. errors can be one of the following:
    • continue โ€” continue normal execution.
    • remount-ro โ€” remount file system read-only.
    • panic โ€” cause a kernel panic. ๐Ÿ’€
  • features โ€” this relation specifies a comma-separated list of features edit requests which modify the feature set used by the newly constructed file system. the syntax is the same as the -O command-line option to mke2fs(8); that is, a feature can be prefixed by a caret (^) symbol to disable a named feature. each features relation specified in the [fs_types] list will be applied in the order found in the [fs_types] list.
  • force_undo โ€” this boolean relation, if set to a value of true, forces mke2fs to always try to create an undo file, even if the undo file might be huge and it might extend the time to create the file system image because the inode table isn't being initialized lazily. ๐Ÿ˜ญ
  • default_features โ€” this relation specifies set of features which should be enabled or disabled after applying the features listed in the base_features and features relations. it may be overridden by the -O command-line option to mke2fs(8).
  • auto_64-bit_support โ€” this relation is a boolean which specifies whether mke2fs(8) should automatically add the 64bit feature if the number of blocks for the file system requires this feature to be enabled. the resize_inode feature is also automatically disabled since it doesn't support 64-bit block numbers.
  • default_mntopts โ€” this relation specifies the set of mount options which should be enabled by default. these may be changed at a later time with the -o command-line option to tune2fs(8).
  • blocksize โ€” this relation specifies the default block size if the user does not specify a block size on the command line.
  • lazy_itable_init โ€” this boolean relation specifies whether the inode table should be lazily initialized. it only has meaning if the uninit_bg feature is enabled. if lazy_itable_init is true and the uninit_bg feature is enabled, the inode table will not be fully initialized by mke2fs(8). this speeds up file system initialization noticeably, but it requires the kernel to finish initializing the file system in the background when the file system is first mounted. โœจ

bestie we're not done yet โ€” there's more coming, don't go anywhere ๐Ÿซถ

  • lazy_journal_init โ€” a boolean, and it's exactly what it sounds like: should that journal inode be initialized lazily? ๐Ÿฆ‹ Heads up tho, it only does anything if the has_journal feature is turned on. If lazy_journal_init is true, mke2fs will not fully zero out the journal inode. The way that speeds up file system initialization is noticeable โœจ, but bestie, it carries some small risk if the system crashes before the journal has been overwritten entirely one time. Small risk, real risk. iykyk ๐Ÿ’…
  • journal_location โ€” this relation specifies the location of the journal. ๐Ÿ“
  • num_backup_sb โ€” tells you whether file systems with the sparse_super2 feature enabled should be created with 0, 1, or 2 backup superblocks. Pick your number, queen ๐Ÿ‘‘
  • packed_meta_blocks โ€” a boolean: should the allocation bitmaps, inode table, and journal all be located at the beginning of the file system? ๐ŸŽ€
  • inode_ratio โ€” the default inode ratio, used when the user does not specify one on the command line. No cap, it's just the fallback vibe. ๐Ÿงš
  • inode_size โ€” the default inode size, again only when the user does not specify one on the command line. ๐ŸŒธ
  • reserved_ratio โ€” the default percentage of file system blocks reserved for the super-user, if the user does not specify one on the command line. ๐Ÿ‘‘
  • hash_alg โ€” the default hash algorithm for new file systems with hashed b-tree directories. Valid algorithms accepted are: legacy, half_md4, and tea. That's the whole menu, bestie ๐Ÿ“
  • flex_bg_size โ€” the number of block groups that will be packed together to create one large virtual block group on an ext4 file system. It improves meta-data locality and performance on meta-data heavy workloads ๐Ÿ”ฅ. Two rules tho: the number of groups must be a power of 2, and it may only be specified if the flex_bg file system feature is enabled.
  • options โ€” extra extended options that mke2fs(8) should treat as if they were prepended to the argument of the -E option. Basically: set your default extended options per-file-system-type and let it cook. ๐Ÿ’…
  • discard โ€” a boolean. Should mke2fs(8) attempt to discard the device prior to file system creation? ๐Ÿ—‘๏ธ
  • set_raid_stride โ€” should the file system's RAID stride size be set from the block device, if available? Valid values are: always, disk, never. The default value is always. โญ
  • set_raid_stripe โ€” same energy, different setting: should the file system's RAID stripe size be set from the block device if available? Valid values are: always, disk, never. The default value is disk. ๐ŸŒˆ
  • cluster_size โ€” the default cluster size when the bigalloc file system feature is enabled. It can be overridden via the -C command line option to mke2fs(8). ๐ŸŽ€
  • make_hugefiles โ€” a boolean that enables the creation of pre-allocated files as part of formatting the file system. The extent tree blocks for these pre-allocated files get placed near the beginning of the file system, so that if all of the other metadata blocks are also configured to be placed near the beginning of the file system (by disabling the backup superblocks, using the packed_meta_blocks option, etc.), the data blocks of the pre-allocated files will be contiguous. It's giving organized. It's giving main character energy. ๐Ÿ‘‘
  • hugefiles_dir โ€” the directory where huge files are created, relative to the file system root. ๐Ÿ“
  • hugefiles_uid โ€” controls the user ownership for all of the files and directories created by the make_hugefiles feature. ๐Ÿ™‹
  • hugefiles_gid โ€” controls the group ownership for all of the files and directories created by the make_hugefiles feature. ๐Ÿ‘ฏ
  • hugefiles_umask โ€” the umask used when creating the files and directories by the make_hugefiles feature. ๐ŸŽญ
  • num_hugefiles โ€” how many huge files to create. If this relation is not specified, or is set to zero, and the hugefiles_size relation is non-zero, then make_hugefiles will create as many huge files as can fit to fill the entire file system. Go off, fill the whole thing ๐Ÿ’–
  • hugefiles_slack โ€” how much space should be reserved for other files. Gotta leave room for the rest of them ๐Ÿซถ
  • hugefiles_size โ€” the size of the huge files. If this relation is not specified, the default is to fill the entire file system. ๐ŸŒธ
  • hugefiles_align โ€” the alignment for the start block of the huge files. It also forces the size of huge files to be a multiple of the requested alignment. If this relation is not specified, no alignment requirement will be imposed on the huge files. ๐Ÿ“
  • hugefiles_align_disk โ€” should the alignment be relative to the beginning of the hard drive (assuming that the starting offset of the partition is available to mke2fs(8))? The default value is false, which will cause hugefile alignment to be relative to the beginning of the file system. ๐Ÿ’ฝ
  • hugefiles_name โ€” the base file name for the huge files. โœจ
  • hugefiles_digits โ€” the (zero-padded) width of the field for the huge file number. So file00001 vibes, not file1 vibes ๐Ÿ”ข
  • warn_y2038_dates โ€” a boolean: will mke2fs(8) issue a warning when creating a file system with 128 byte inodes (and so therefore will not support dates after January 19th, 2038)? The default value is true, except for file systems created for the GNU Hurd, since it only supports 128-byte inodes. โฐ
  • zero_hugefiles โ€” a boolean: should zero blocks be written to the hugefiles while mke2fs(8) is creating them? By default, zero blocks will be written to the huge files to avoid stale data from being made available to potentially untrusted user programs โ€” unless the device supports a discard/trim operation which will take care of zeroing the device blocks. By setting zero_hugefiles to false, this step will always be skipped, which can be useful if it is known that the disk has been previously erased, or if the user programs that will have access to the huge files are trusted to not reveal stale data. ๐Ÿ‘€
Bestie, read that one twice. Setting zero_hugefiles to false means no zeroing, ever, and stale data could be visible to whatever can read those files. Only do it if you actually know the disk was erased or you fully trust the programs touching those files. ๐Ÿ’€
  • encoding โ€” defines the file name encoding to be used if the casefold feature is enabled. Currently the only valid encoding is utf8-12.1 or utf8, which requests the most recent Unicode version; since 12.1 is the only available Unicode version, utf8 and utf8-12.1 have the same result. ๐ŸŒ
  • encoding_flags โ€” defines encoding-specific flags. For utf8 encodings, the only available flag is strict, which will cause attempts to create file names containing invalid Unicode characters to be rejected by the kernel. Strict mode is not enabled by default. ๐Ÿšซ

๐ŸŽ€ THE [devices] STANZA ๐ŸŽ€

Each tag in the [devices] stanza names a device name, so that per-device defaults can be specified. Per-device defaults?? The customization is unmatched ๐Ÿ’…

  • fs_type โ€” the default parameter for the -t option, if this option isn't specified on the command line. ๐ŸŒธ
  • usage_types โ€” the default parameter for the -T option, if this option isn't specified on the command line. ๐Ÿฆ‹

๐Ÿ“ FILES ๐Ÿ“

  • /etc/mke2fs.conf โ€” the configuration file for mke2fs(8). This is the file, the one we've been talking about this entire time ๐Ÿซถ

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€


And that's the whole page, bestie, we ate and left no crumbs ๐Ÿ’…โœจ This was E2fsprogs version 1.47.4, dated March 2025, and yes, it's the mke2fs.conf(5) manual page โ€” go configure something iconic ๐Ÿ‘‘๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from