Converting ext2/3 to ext4

1 min read

The Linux Ext2 and Ext3 file systems are now obsolete, but unfortunately you still come across servers that use them. It’s time to upgrade the old file systems to the latest version, Ext4. The Ext4 file system is faster and more reliable than previous versions.

Don’t worry! You don’t need to reinstall the system; you can simply convert your existing file system to EXT4 without affecting your stored data.

First, make a backup of all your data, then follow the steps below.

Converting the file system to ext4

In this example, we are converting the /dev/sda1 partition; you must replace this with your own partition.

Run the following command to convert from ext2 to ext4:

sudo tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/sda1

To convert from ext3 to ext4, run the following command:

sudo tune2fs -O extents,uninit_bg,dir_index /dev/sda1

After running the tune2fs commands, run the fsck command to fix any file system issues that may have arisen during the steps above:

sudo e2fsck -pf /dev/sda1

Once all this has been done, don’t forget to update the file system type in the /etc/fstab file as well!

Back to the blog