Here's how you upgrade to ext4. The process is pretty easy, but requires an fsck which means unmounting or rebooting if the file system is in use.

Make sure you are using at least e2fstools 1.41.3 and kernel 2.6.28 (or a vendor kernel with latest ext4 patches applied)! Also, it's probably a good idea to have proper backups (really!). ext4 has just been declared stable, but what that really means is that the battle hardening has just begun. I've done several heavily used systems without fault so far though, so it's probably good enough for your desktop.

WARNING: DON'T CONVERT YOUR /boot PARTITION. Right now, there is no stable version of grub with ext3 support. Even if there was, it really won't gain you anything :-).

Run tune2fs, e.g.:

tune2fs -I 256 -O sparse_super,filetype,resize_inode,dir_index,ext_attr,has_journal,  
extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize /dev/sd[x][n]

Those are the default options for an ext4 file system if you were to create it with mkfs.ext4 (e2fsprogs 1.41.3 - see /etc/mke2fs.conf). I'm getting pretty damn good performance with this! The '-I 256' option sets 256 bit inodes, which most recent ext3 FSs use already. If this is the case, and you get a message telling you so, remove this option. Note that extents will make the FS backwards INCOMPATIBLE with ext3.

Next, edit /etc/fstab, e.g.:

/dev/vg/home /home ext4 defaults 0 0

Either unmount and mount or reboot your system. tune2fs marks the fs as dirty and performs a fsck and conversion.
NOTICE: distros with initrds may need to be regenerated or you won't be able to mount your root file system. In Fedora (replace kernel version with your own):

cd /boot
mv initrd- initrd-
mkinitrd initrd- initrd-

That's all there is to it. Stay tuned for future ext4 developments like online defragmentation.

Also, ext{2,3,4} reserve 5% of space for root in case the drive fills up. On large modern drives, this can be excessive (e.g: 50GB on a 1TB disk). Consider running 'tune2fs -m 1 /dev/sd[x][n]' to reduce this to 1%.

For more information and tweaking:

  1. Documentation/filesystems/ext4.txt from the latest kernel sources
  3. man tune2fs


comments powered by Disqus