mke2fs − create a Linux second extended file system


mke2fs [ −c | −l filename ] [ −b block-size ] [ −f fragment-size ] [ −i bytes-per-inode ] [ −N number-of-inodes ] [ -n ] [ −m reserved-blocks-percentage ] [ −o creator-os ] [ −O feature[,...] ] [ −q ] [ −r fs-revision-level ] [ −R raid_options ] [ −s sparse-super-flag ] [ −v ] [ −F ] [ −L volume-label ] [ −M last-mounted-directory ] [ −S ] [ −T filesystem-type ] [ −V ] device [ blocks-count ]


mke2fs is used to create a Linux second extended file system on a device (usually a disk partition). device is the special file corresponding to the device (e.g /dev/hdXX). blocks-count is the number of blocks on the device. If omitted, mke2fs automagically figures the file system size.


−b block-size

Specify the size of blocks in bytes. Valid block size vales are 1024, 2048 and 4096 bytes per block. If omitted, mke2fs block-size is determined by the file system size and the expected usage of the filesystem (see the −T option).


Check the device for bad blocks before creating the file system, using a fast read-only test.

−f fragment-size

Specify the size of fragments in bytes.

−i bytes-per-inode

Specify the bytes/inode ratio. mke2fs creates an inode for every bytes-per-inode bytes of space on the disk. The larger the bytes-per-inode ratio, the fewer inodes will be created. This value generally shouldn’t be smaller than the blocksize of the filesystem, since then too many inodes will be made. Be warned that is not possible to expand the number of inodes on a filesystem after it is created, so be careful decided the correct value for this parameter.


causes mke2fs to not actually create a filesystem, but display what it would do if it were to create a filesystem.

−N number-of-inodes

overrides the default calculation of the number of inodes that should be reserved for the filesystem (which is based on the number of blocks and the bytes-per-inode ratio). This allows the user to specify the number of desired inodes directly.

−O feature[,...]

Create the filesystem with the listed set of features (filesystem options). The following features are supported: sparse_super, which cause the filesystem to use sparse superblocks, and filetype, which will cause the filesystem to store file type information in directory entries. Currently, both features are turned on by default unless mke2fs is run on a system with a pre-2.2 Linux kernel. Warning: Pre-2.2 Linux kernels do not properly support the filesystems that use either of these two features. Filesystems that may need to mounted on pre-2.2 kernels should be created with -O none which will disable both of these features, even if mke2fs is run on a system which can support these features.

−l filename

Read the bad blocks list from filename.

-m reserved-blocks-percentage

Specify the percentage of reserved blocks for the super-user. This value defaults to 5%.


Manually override the default value of the "creator os" field of the filesystem. Normally the creator field is set by default to the native OS of the mke2fs executable.


Quiet execution. Useful if mke2fs is run in a script.

−s sparse-super-flag

If sparse-super-flag is 1, then turn on the sparse superblock flag in the superblock. Note: This option is deprecated; use the −O option instead.


Verbose execution.


Force mke2fs to run, even if the specified device is not a block special device, or appears to be mounted.


Set the volume label for the filesystem.


Set the last mounted directory for the filesystem. This might be useful for the sake of utilities that key off of the last mounted directory to determine where the filesytem should be mounted.

-r revision

Set the filesystem revision for the new filesystem. Note that 1.2 kernels only support revision 0 filesystems.

−R raid_options

Set raid-related options for the filesystem. Raid options are comma separated, and may take an argument using the equals (’=’) sign. Currently the only supported argument is stride which takes as its argument the number of blocks in a RAID stripe.


Write superblock and group descriptors only. This is useful if all of the superblock and backup superblocks are corrupted, and a last-ditch recovery method is desired. It causes mke2fs to reinitialize the superblock and group descriptors, while not touching the inode table and the block and inode bitmaps. The e2fsck program should be run immediately after this option is used, and there is no guarantee that any data will be salvageable.

−T fs-type

Specify how the filesystem is going to be used, so that mke2fs can automatically determine the optimal filesystem parameters. The only filesystem type which is currently supported is "news".


Print the version number of mke2fs and exit.


This version of mke2fs has been written by Theodore Ts’o <>.


mke2fs accepts the −f option but currently ignores it because the second extended file system does not support fragments yet.
There may be some other ones. Please, report them to the author.


mke2fs is part of the e2fsprogs package and is available for anonymous ftp from in /pub/linux/packages/ext2fs.


badblocks(8), dumpe2fs(8), e2fsck(8), tune2fs(8)