Home » Debian, Featured, How-to, Linux, Newbie, Tuning, Ubuntu

Migrating from Ext3 to Ext4

24 March 2009 No Comment

Ext3 to Ext4 Migration

Ext3 to Ext4 Migration

Ext4 is the normal evolution of the most used Linux filesystem: Ext3. The evolution of Ext3 from Ext2 had add just 1 new important feature: journalization. But ext4 is a result of hardly improved Ext3 and is coming with better performance, modified data structures, reliability and new features like bigger filesystem/file sizes, subdirectory scalability, extents, multiblock allocation, delayed allocation, journal checksumming, online defragmentation, persistent preallocation.

The first stable version of ext4 is already out and probably a lot of you want to test it a little bit, so I write this article for a smooth conversion from Ext3 to Ext4.

Is possible to have incompatibilities between your GRUB and ext4. Only latest version of Grub supports ext4. So is more healthy to have a /boot partition with Ext3 file system installed.

First time check if your tools and your kernel support ext4. Look at e2fsprogs version 1.41.3 or later and at your kernel if you have ext4dev (I recommend 2.6.28).

Also if you are tring to mount your root filesystem as ext4 through initramfs is possible to fail because fstype is detecting the filesystem as ext3 and not ext4. To solve that just add rootfstype=ext4 in the kernel command line.

Migrating from Ext3 to Ex4

First we need to add the needed features of ext4 filesystem

[root@randombugs]# tune2fs -O extents,uninit_bg,dir_index /dev/yourfilesystem

Now your filesystem need to be cleanead with fsck (probably your journal checksums doesn’t exists).

[root@randombugs]# fsck -fp /dev/yourfilesystem

-f is to force checking even if the filesystem seems clean
-p is to assume y to all your questions (is a little bit risky … so you are not forced to used it)

Usually right now you will need to be able to mount your ext4 filesystem.

[root@randombugs]# mount -t ext4dev /dev/yourfilesystem /mnt

But under Ubuntu trying to mount the filesystem I get this error

[root@randombugs]# mount -t ext4dev /dev/yourfilesystem /mnt
mount: wrong fs type, bad option, bad superblock on /dev/hdd1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog – try
dmesg | tail or so

looking in dmesg I found the real reason of this error

EXT4-fs: sdxx: not marked OK to use with test code.

Googling a little bit I found fix for the test code

[root@randombugs]# tune2fs -E test_fs /dev/yourfilesystem

Just run a lsmod to see if ext4dev module is loaded in kernel

[root@randombugs]# lsmod | grep ext4
ext4dev 251568 1
jbd2 77360 1 ext4dev
crc16 10496 1 ext4dev
mbcache 17924 2 ext4dev,ext3

Now mount your filesystem

[root@randombugs]# mount -t ext4dev /dev/yourfilesystem /mnt

Good Luck.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.