mke2fs command is used to create a new “ext2/ext3” filesystem on a disk partition. This command is used to format a disk partition with the “ext2” or “ext3” filesystem. The “ext2” filesystem is an older version of the “ext3” filesystem, which is a journaled filesystem.
The syntax for the
mke2fs command is as follows:
mke2fs [options] device
device refers to the block device or partition on which the filesystem is to be created. The
mke2fs command creates an “ext2” or “ext3” filesystem on the specified device. The options available for this command are listed below.
To create an “ext3” filesystem on the partition
/dev/sda1, use the following command:
mke2fs -t ext3 /dev/sda1
To create an “ext2” filesystem on the partition
/dev/sdb2, use the following command:
mke2fs -t ext2 /dev/sdb2
mke2fs command is typically used when setting up a new disk partition or when reformatting an existing partition. This command can be used to create a new filesystem on a partition that has never been formatted before, or to reformat a partition that previously had a different filesystem.
The following options are available for the
||Set the block size of the filesystem.|
||Check the device for bad blocks before creating the filesystem.|
||Force the creation of the filesystem, even if the device already contains a filesystem.|
||Set the bytes per inode of the filesystem.|
||Create an “ext3” filesystem.|
||Set journal options for the filesystem.|
||Set the volume label of the filesystem.|
||Set the percentage of blocks reserved for the super-user.|
||Do not create a filesystem, just print out the parameters that would be used.|
||Set filesystem features.|
||Create a “ext2” filesystem.|
||Set the usage type of the filesystem.|
||Set the UUID of the filesystem.|
||Print the version of the
- If the
mke2fscommand fails with an error message, make sure that the device is not mounted. The
mke2fscommand cannot create a filesystem on a mounted device.
- If the device already contains a filesystem, use the
-Foption to force the creation of a new filesystem. Note that this will erase all data on the device.
- If the device has bad blocks, use the
-coption to check for bad blocks before creating the filesystem. Note that this may take a long time, depending on the size of the device.
mke2fscommand is typically used with the
mkfscommand, which is a wrapper command that automatically selects the appropriate filesystem creation tool based on the specified filesystem type. For example, the command
mkfs.ext3 /dev/sda1is equivalent to
mke2fs -t ext3 /dev/sda1.
- The “ext2” and “ext3” filesystems are commonly used on Linux systems, but they are not the only filesystems available. Other popular filesystems include “ext4”, “XFS”, and “Btrfs”.