The mkfs command on Linux
A file system creates the layout on the partition the operating system needs to store data. We cannot use a partition to store data if it does not have a file system. We use the mkfs command with the t option to create a file system on a partition. This command needs two arguments: the file system's name and the partition's path. It makes the specified file system on the selected partition. For example, the following command creates an EXT3 file system on the /dev/sda1 partition.
#mkfs -t ext3 /dev/sda1

The following command creates an EXT4 file system on the /dev/sda2 partition.
#mkfs -t ext4 /dev/sda2

The following command creates an XFS file system on the /dev/sda3 partition.
#mkfs -t xfs /dev/sda3

We can create a file system only on the partition that stores data. Since the extended partition does not store data, we can not create a file system. An extended partition contains logical partitions. It uses a partition table to store them. If we try to create a file system on it, the command finds this partition table and pauses the process. It prompts us to confirm the operation. Confirming the operation creates a file system on the extended partition, making the logical partitions inaccessible.
We use logical partitions to store data. We can create file systems on them. The following command creates an EXT4 file system on the /dev/sda5 partition.

Linux file systems
Linux uses EXT and XFS file systems.

EXT
It was the first Linux file system. It was used in early versions of Linux.
EXT2
It was the second generation of the EXT file system. It provides essential features. It was developed in 1980. It was the default file system before RHEL5.
EXT3
It was the third generation of the EXT file system. It was the default file system in RHEL5. It was the first file system in the EXT series that supports the journaling mechanism. It supports a file up to 2 TB in size.
EXT4
It is the fourth generation of the EXT file system. It was the default file system in RHEL6. It uses a series of contiguous physical blocks on the hard disk known as extents. The extents are used to improve the performance of huge files.
XFS
Silicon Graphics developed it for UNIX. Later, it was adopted by most Linux distributions, including RHEL. It was the default file system in RHEL7. This file system is based on 64-bit extent. It uses journaling for metadata operations. It supports file systems and files of sizes up to 8 exabytes. The only drawback of this system is that it does not support the shrink feature like EXT3 and EXT4.
This tutorial is part of the tutorial series Linux disk management concepts and configurations. Other parts of this series are the following.
Chapter 01 Linux disk management terminologyChapter 02 File Management Commands in Linux
Chapter 03 Linux file system types explained
Chapter 04 Adding and removing hard disks in VMware Workstation
Chapter 05 List view and find hard disk names in Linux
Chapter 06 The fdisk command on Linux explained
Chapter 07 Manage Linux disk partition with the gdisk command
Chapter 08 The /etc/fstab file on Linux explained
Chapter 09 Linux disk management with the parted command
Chapter 11 The mount command on Linux temporary mounting
Chapter 12 The swap space on Linux explained
Chapter 13 How to create a swap partition in Linux
Chapter 14 How to configure LVM in Linux step-by-step
Chapter 15 How to configure RAID in Linux step-by-step
Conclusion
The mkfs command is a crucial tool for creating file systems on partitions, enabling the storage and organization of data. Various file systems, such as EXT3, EXT4, and XFS, cater to different needs and offer unique features. Understanding the differences among these file systems allows us to effectively manage data storage on Linux systems, ensuring optimal performance and accessibility.
By ComputerNetworkingNotes Updated on 2026-01-31