mkfs.ext4
The mkfs.ext4
command line tool is used to create an ext4 file system. It is commonly used in Linux distributions to format storage devices such as hard drives and USB drives.
To use mkfs.ext4
, you need to specify the device or partition you want to format. For example, mkfs.ext4 /dev/sdb1
formats the partition /dev/sdb1
with the ext4 file system.
This tool offers various options to customize the formatting process. You can set the filesystem label using the -L
option, specify the number of reserved blocks with -m
, and even select the block size with -b
.
The mkfs.ext4
command usually checks the device for errors and initializes the file system data structures. It also creates the required superblock, inode table, and block bitmap.
Once a file system is created with mkfs.ext4, you can mount it to a directory using the mount
command and start using it to store files and directories.
It's important to note that formatting a storage device erases all data, so always make sure to backup any important files before using mkfs.ext4
.
List of commands for mkfs.ext4:
-
mke2fs:tldr:f579d mke2fs: Create an ext4 filesystem in partition 1 of device b (`sdb1`).$ mkfs.ext4 ${-dev-sdb1}try on your machineexplain this command
-
mkfs.ext4:tldr:d9e14 mkfs.ext4: Create an ext4 filesystem with a volume-label.$ sudo mkfs.ext4 -L ${volume_label} ${-dev-sdb1}try on your machineexplain this command