ext4 becomes usable and has various advantages compared to the old grown ext3. Still, a conversation remains backwards compatible so only new files written will be in ext4 format while the old files remain in ext3 mode.
Always make a backup! And in case of changing /, /home or /boot you should keep the filesystems unmounted (live cd) changing the fs where grub runs on also requires a grub reinstall!
Open /etc/fstab to get an idea which filesystems should be converted. Furthermore, if there’s the UUID management (which is way more safe than depending on /dev/sd*), use df -h to find out which device should be converted.
$ sudo vim /etc/fstab $ df -h | grep home /dev/sdb4 ext3 131G 68G 57G 55% /home
Now change the filesystem to ext4 in /etc/fstab and reboot in order to activate kernel mode for ext4
UUID=20869f08-830d-41cb-8ac6-bdc9c0eeaf02 /home ext4 defaults,noatime,errors=remount-ro 0 2
Now check that this is being done.
$ df -h | grep home /dev/sdb4 ext4 131G 68G 57G 55% /home
Now for the fun part – enable the ext4 feature set. Best would be to have /home unmounted, but it could work on the fly too.
$ sudo tune2fs -O extents,uninit_bg,dir_index /dev/sdb4 tune2fs 1.42-WIP (02-Jul-2011)
Now it’s time to let fsck check the filesystem. This can be resolved by another reboot, as tune2fs marked the fs as ‘dirty’ meaning that fsck will check the fs on boot. If automatic fsck fails on boot, type your root password and run it manually as shown above
# fsck /dev/XXX
After having finished, issue another reboot by
# init 6
Special note on changing the filesystem where grub is installed (/ or /boot):
It works basically the same as noted above, but grub cannot handle ext4 by default. Make sure that grub2 is installed
# apt-get install grub2
and targetted on the correct device (if installed on /dev/sdb3 the device is /dev/sdb).
# grub-install /dev/sdb
It would be ok for the first reboot because the existing kernel files are not converted to ext4 and grub can read those but when upgrading the kernel new images will be written into /boot and grub won’t be able to handle ext4 then. So beware! 🙂