What is Ext2, Ext3 & Ext4 and How to Create and Convert Linux File Systems

I have used my Fedora old system to test where I converted from ext2 to ext3, ext2 to ext4, and ext3 to ext4 file systems successfully.

By following this guide anyone can convert their file systems smartly, but still, I like to WARN you all before doing this because the following task required skilled administrative practices, and make sure you must take the important backup of your files before doing this. If in case something goes wrong at least you can revert to back with your backup data.

In a computer, a file system is a way in which files are named and placed logically to store, retrieve, and update the data and also used to manage space on the available devices.

The file system is divided into two segments called User Data and Metadata. In this article, I am trying to explore how to create and convert various Linux file systems and high-level differences amongst Ext2, Ext3, and Ext4 file systems.

Before moving further readings, let me introduce a brief about Linux file systems.

Ext2 – Second Extended File System

  1. The ext2 file system was introduced in 1993 and Ext2 was developed by Remy Card. It was the first default file system in several Linux distros like RedHat and Debian.
  2. It was to overcome the limitation of the legacy Ext file system.
  3. Maximum file size is 16GB – 2TB.
  4. The journaling feature is not available.
  5. It’s being used for normally Flash-based storage media like USB Flash drive, SD Card, etc.

Ext3 – Third Extended File System

  1. Ext3 file system was introduced in 2001 and the same was integrated with Kernel 2.4.15 with a journaling feature, which is to improve reliability and eliminates the need to check the file system after an unclean shutdown.
  2. Max file size 16GB – 2TB.
  3. Provide facility to upgrade from Ext2 to Ext3 file systems without having to back up and restore data.

Ext4 – Fourth Extended File System

  1. Ext4, the high-anticipated Ext3 successor.
  2. In October 2008, Ext4 as stable code was merged in Kernel 2.6.28 which contains an Ext4 file system.
  3. Backward compatibility.
  4. Max file size 16GB to 16TB.
  5. The ext4 file system has the option to Turn Off the journaling feature.
  6. Other features like Sub Directory Scalability, Multiblock Allocation, Delayed Allocation, Fast FSCK etc.

How to Determine File System Type?

To determine your Linux file system type, run the following command in the terminal as a root user.

# df -hT | awk '{print $1,$2,$NF}' | grep "^/dev"
/dev/sda3 ext3 /
/dev/sda1 ext3 /boot
Warning: Please take important data backup before executing below commands.

Creating an Ext2, or Ext3, or Ext4 File Systems

Once you create a file system using fdisk or parted command, use mke2fs command to create either of the file system and make sure you replace hdXX with your device name.

Creating a Ext2 File System

# mke2fs /dev/hdXX

Creating a Ext3 File System

# mke2fs –j  /dev/hdXX
# mkfs.ext3  /dev/hdXX

-j option is used for journaling.

Creating the Ext4 File System

# mke2fs -t ext4 /dev/hdXX
# mkfs.ext4 /dev/hdXX

-t option to specify the file system type.

Converting an Ext2, or Ext3, or Ext4 File Systems

It is always a better way to unmount the file systems and convert them. Conversion can be done without unmounting and mounting the filesystem. Again replace hdXX with your device name.

Converting Ext2 to Ext3

To change an ext2 file system to ext3 enabling the journal feature, use the command.

# tune2fs -j /dev/hdXX

Converting Ext2 to Ext4

To convert from old ext2 to new ext4 file system with the latest journaling feature. Run the following command.

# tune2fs -O dir_index,has_journal,uninit_bg /dev/hdXX

Next, do a complete file system check with the e2fsck command to fix and repair.

# e2fsck -pf /dev/hdXX

-p option automatically repairs the file system.
-f option forces checking file system even it seems clean.

Converting Ext3 to Ext4

To enable the ext4 features on an existing ext3 filesystem, use the command.

# tune2fs -O extents,uninit_bg,dir_index /dev/hdXX

WARNING: You cannot revert or mount back to the ext3 filesystem once you run the above command.

After running this command we MUST run fsck to fix up some on-disk structures that tune2fs have modified.

# e2fsck -pf /dev/hdXX

WARNING: Please try all these above commands on your testing Linux server.

If you read this far, tweet to the author to show them you care. Tweet a thanks
Narad Shrestha
He has over 10 years of rich IT experience which includes various Linux Distros, FOSS and Networking. Narad always believes sharing IT knowledge with others and adopts new technology with ease.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

14 thoughts on “What is Ext2, Ext3 & Ext4 and How to Create and Convert Linux File Systems”

  1. Hello Ravi,

    I bought the RHCSA V8 book a couple of weeks ago. The book is missing RHCSA V8 topics such as Virtual data Optimizer(VDO) and tuned.

    Can they be added, please? I need them to prepare for the RHCSA exam.

    • @Tam,

      Thanks for updating us, yes in next update I will add this topic, hopefully, will re-distribute updated copies by next week.

  2. [[email protected] appdata]# tune2fs -o dir_index,has_journal,uninit_bg /dev/sda7
    tune2fs 1.41.12 (17-May-2010)
    Invalid mount option set: dir_index,has_journal,uninit_bg
    [[email protected] appdata]# tune2fs -o extents,uninit_bg,dir_index /dev/sda5
    tune2fs 1.41.12 (17-May-2010)
    Invalid mount option set: extents,uninit_bg,dir_index

    I hit these both commands and it says invalid mount options set.

  3. I think it should be “Partitions instead of File Systems” in this line “Once you create file system using fdisk or parted command, use mke2fs command to create either of file system and make sure you replace hdXX with your device name.”

  4. A nice way is to manage LVM through ssm. Only one step-we can create a logical volume and volume group, choose file system type.
    ex: sudo ssm create -s 200GB -n disk0 –fstype ext4 -p my_volume /dev/sda /mount

    So we create a volume group named “my_volume”, create a 200GB LVM volume named disk0, after that format the volume ext4 file system, and mount it under “/mount” mounting point.


Leave a Reply to Tam Suthananthan Cancel reply

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.