How to convert a EXT2 file system to EXT4

There may be a time when you need to convert a EXT2 file system to EXT4. This guide will help you through that process.

These commands will make changes to your file system! Make sure you have a working backup before completing these steps!

First ensure your filesystem is not mounted!

Before proceeding you should make sure your file system is not currently mounted. If the file system your going to be doing this too is your root file system then you should boot off a recovery disk or live env. You must make sure your disk is not in use!

Force check the filesystem

Again, we cannot stress this enough. Make sure your FS is not mounted. If it is, you going to cause damage!

First run the following command.

fsck /dev/mapper/VolGroup00-LogVol00

Chances are the FS is going to say it's clean. If it's not let it do it's thing and you can skip the next step. If the FS is clean, we are going to force a check on the FS.

fsck -f /dev/mapper/VolGroup00-LogVol00

Convert to EXT4

We can not use tune2fs to convert the filesystem to EXT4 using the following command.

tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/mapper/VolGroup00-LogVol00

Run final fsck check

Yep, we need to run fsck one last time! We are again forcing a fsck check, make sure the device is not in use!

fsck -f /dev/mapper/VolGroup00-LogVol00

Verify the FS is now EXT4

You can verify your device is now EXT4 by running the following command.

blkid /dev/mapper/VolGroup00-LogVol00