Introduction to the mkfs.ext2 Command
In this step, you will learn about the mkfs.ext2
command, which is used to create an ext2 file system on a partition. The ext2 file system is one of the oldest and most widely used file systems in the Linux operating system.
The mkfs.ext2
command is used to format a partition or block device with the ext2 file system. The ext2 file system is a journaling file system, which means that it keeps track of changes to the file system and can recover from system crashes or power failures more easily than non-journaling file systems.
To create an ext2 file system, you can use the following command:
sudo mkfs.ext2 /dev/sdb1
This command will create an ext2 file system on the /dev/sdb1
partition.
Example output:
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 2621440 1k-blocks and 655360 inodes
Filesystem UUID: 5e7c1c2f-0c7a-4f3e-b9d6-a9d4d5e8b7a0
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
The mkfs.ext2
command has several options that you can use to customize the file system. For example, you can specify the block size, the number of inodes, and the file system label. You can use the man mkfs.ext2
command to learn more about the available options.