With the release of Jaunty allot of people will be doing an upgrade from Intrepid (if they did not do it already) to Jaunty. If you are one of those people and you don’t want to miss out using the new ext4 file system, there is a way to convert your existing ext2 and/or ext3 file system to ext4.

Please note that converting-to/using ext4 is by no means necessary, you are not missing out if you are using ext3 (hell, ext2 is still widely in use). So only do this if you like to hack and get your hands dirty. I did however convert my production machine from ext3 to ext4 just because I wanted to :guitar:

Step one:
Upgrade to Jaunty. You now have a working Jaunty install running the ext3 file system.
Make sure you are running kernel 2.6.28-11-generic or higher.
To check which kernel you are running:

uname -a

Step two:
Make a backup of all your (important) data.

Step three:
EDIT: Some extra info on how to convert from ext2 to ext4 (thanks, groggyboy)

Boot from a (Jaunty) live-cd and run the following code (in this example the partition to convert is on /dev/sda1) to convert the partition:
To convert from ext3 to ext4:

sudo bash
tune2fs -O extents,uninit_bg,dir_index /dev/sda1
e2fsck -pf /dev/sda1

To convert from ext2 to ext4:

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

Step four:
Mount the partition and change the type of the converted partition in fstab:

sudo bash
mount -t ext4 /dev/sda1 /mnt
nano /mnt/etc/fstab

change “ext3” to “ext4” like in the example below:

# /dev/sda1
UUID=XXXXXXXXXXXXXXXXXXXXXXXXXX / ext3 relatime,errors=remount-ro 0 1

change it to:

# /dev/sda1
UUID=XXXXXXXXXXXXXXXXXXXXXXXXXX / ext4 relatime,errors=remount-ro 0 1

and save the changes.

Step five:
EDIT: Some extra info on how to refresh grub when you have a separate /boot partition (thanks, utkjamie)

This step might be optional but when I upgraded from Intrepid to Jaunty the upgrade process did not install/update the new grub stage. So if you don’t run either of the following code examples you might get an (fatal) error 13 when booting the machine.
Use this code to refresh grub when you do not have a separate /boot partition (in this example the root partition is sda1)

sudo bash
mount /dev/sda1 /mnt
grub-install /dev/sda –root-directory=/mnt –recheck

Use this code to refresh grub when you do have a separate /boot partition (in this example the /boot partition is sda1)

sudo bash
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
grub-install /dev/sda –root-directory=/mnt –recheck

That’s it, after you reboot you you will be running from an ext4 file system.
As a side note, all the files that where present before the conversion will not benefit from the conversion as they were written to disk using ext3 technology. Only newly created or overwritten files will be using the true ext4 technology (so now, using update-manager will be extra beneficial :lolflag:). As ext3 and ext4 are compatible with each other having files written to disk in ext3 mode on your ext4 file system do not impose any risks (and most if not all ext3 sectors could eventually disappear even without defragging).

There is currently a online-defragging tool in development (e4defrag) which should be available with the next kernel release.