Ext4 was released as a functionally complete and stable filesystem in Linux 2.6.28, and it's getting included in all the modern distros (in some cases as the default fs), so if you are using a modern distro, it's possible that you already have Ext4 support and you don't need to modify your system to run Ext4.
It's safe to use it in production environments, but as any piece of software, it has bugs (which are more likely to be hit in the first stable versions). Any known critical bug will be quickly fixed. If you find one, you can contact the Ext4 developers at the ext4 mailing list. They sometimes also can be found on IRC.
Getting Ext4 code
For people who build their own kernel
1. Start with a 2.6.28 or later kernel. It is highly recommended that you apply the latest patchset (if available) to get the latest bug fixes. In your kernel's .config file, enable EXT4_FS (along with EXT4_FS_XATTR and EXT4_FS_POSIX_ACL if you like).
2. Compile the latest version of e2fsprogs (as of this writing 1.41.4) from kernel.org or from Sourceforge. Note that it is highly important to install the mke2fs.conf file that comes with the e2fsprogs 1.41.x sources in /etc/mke2fs.conf. If you have edited the /etc/mke2fs.conf file, you will need to merge your changes with the version from e2fsprogs 1.41.x.
For people who are running Fedora
Fedora 10 currently has a kernel based on 2.6.27 that has working ext4 support. It is missing some of the latest fixes and performance optimizations. A 2.6.28 kernel update should be available reasonably soon, with more up-to-date ext4 code.
Fedora 10 has all of the basic infrastructure needed to be able to run ext4, including updated udev, blkid, and other bits needed for ext4 to be a transparently recognized filesystem.
e2fsprogs-1.41.0 is currently in the Fedora 9 updates-testing repository, and users wishing to utilize ext4 should use this version of e2fsprogs, or later.
For people who are running RHEL
ext4 is currently included as a Technology Preview in RHEL 5.3. To use it, update to 5.3, boot into 2.6.18-128.el5 or higher, and yum install e4fsprogs.
For people who are running openSuSE
- Run tune2fs -O extents,uninit_bg /dev/ROOT
- Change ext3 to ext4 in /etc/fstab
- Add "ext4" to INITRD_MODULES in /etc/sysconfig/kernel
- Run sudo mkinitrd (takes about 2 min here, dunno why)
- Run e2fsck on the ROOT fs. As this is currently mounted, you might want to change into single user mode (init 1) and remount read-only (mount -o remount,ro /) or just reboot and the bootprocess will complain a bit and run e2fsck anyway - don't know if this is The Right Thing To Do though...
Note: Booting off an ext4 partition is still unsupported with the GrUB version currently available for openSuSE, so be sure to have /boot as an extra partition before converting your rootfs to ext4!
For people who are running Ubuntu
Ubuntu 9.04 and later include ext4 as a manual partitioning option at installation time, including support for ext4 as the root filesystem.
For people who are running Ubuntu, it is *highly* recommended that you download a set of modified util-linux packages and install them. Packages for Ubuntu Hardy are available here. These packages revert a change made by Ubuntu to use the volid library instead of the blkid library. The volid library has a number of shortcomings, including that they don't work on freshly created filesystems or swap devices until after you reboot (since it is tied to udev probing) and the volid library doesn't understand ext4dev filesystems. The blkid library is much better, and Debian uses the blkid library for util-linux. Unfortunately, Ubuntu chose to make this decision for some unknown reason. For other versions of Ubuntu, the patch that was applied can be found here.
For people who are running Debian
In Debian Lenny (Testing), the following current packages provide ext4 support:
- ext4dev module in the linux-image package (2.6.26-10)
- e2fsprogs (1.41.3-1)
It should be noted that the stock 2.6.26 ext4 has problems with delayed allocation and with filesystems with non-extent based files. So until Debian starts shipping a 2.6.27 based kernel or a 2.6.26 kernel with at least the 2.6.26-ext4-7 patchset, you should mount ext4dev filesystems using -o nodelalloc and only use freshly created filesystems using "mke2fs -t ext4dev". (Without these fixes, if you try to use an ext3 filesystem which was converted using "tune2fs -E test_fs -o extents /dev/DEV", you will probably hit a kernel BUG the moment you try to delete or truncate an old non-extent based file.)
For people who are running Ark Linux
Ark Linux dockyard-devel has ext4 support, including ext4 support during installation. grub is also patched to boot from ext4 /boot partitions. To install an Ark Linux system with ext4 as main filesystem, get the dockyard-devel image (or, once released, any 2009.x release), and type "fs=ext4" at the CD boot prompt to override the default setting. Depending the outcome of (pending) performance tests, fs=ext4 may be made the default for 2009.1.
If you're on the stable branch, install the kernel, kernel-filesystem-ext4 and e2fsprogs packages from dockyard-devel.
Creating ext4 filesystems
Creating a new ext4 filesystem is very easy once you have upgraded to e2fsprogs 1.41 or later. Simply type:
# mke2fs -t ext4 /dev/DEV
# mkfs.ext4 /dev/DEV
Once the filesystem is created, it can be mounted as follows:
# mount -t ext4 /dev/DEV /wherever
If you have a sufficiently new system, the "-t ext4" should not be needed.
NOTE: Although very large fileystems are on ext4's feature list, current e2fsprogs currently still limits the filesystem size to 2^32 blocks (16T for a 4k block filesystem). Filesystems larger than 16T is one of the very next high-priority features to complete for ext4.
Booting from an ext4 filesystem
Right now there's not a stable version of grub that supports booting a kernel from a ext4 partition. It's recommended that you keep /boot in a ext3 partition.
Preliminary ext4 support seems to have been added to the 1.97 version of the GRUB2 development branch.
There's also a Google Summer of Code project (from opensuse) which seem to have developed ext4 grub support. Both projects -GRUB2 and the GSoC projects- seem (sadly) to be different efforts.
The grub package in Ubuntu 9.04 and later includes a patch to support booting from ext4 filesystems (see bug 314350).
Converting an ext3 filesystem to ext4
It is possible to mount both ext3 (and ext2, in kernels 2.6.28 and later) filesystems directly using the ext4 filesystem driver. This will allow you to use many of the in-core performance enhancements such as delayed allocation (delalloc) and multi-block allocation (mballoc), and large inodes if your ext3 filesystem have been formatted with large inodes as is the default with newer versions of e2fsprogs. Simply mounting an ext3 (or ext2) filesystem with a modern (2.6.27+) version of ext4 will not change the on-disk structures, and it is possible to revert to the ext3 (or ext2) driver should there be any problem with ext4.
In addition to the in-core performance enhancements, there are additional features which modify the on-disk format from what ext3 understands, such as extents, which can significantly improve the ext4 filesystem performance, but mean the filesystem cannot be mounted by kernels that do not support ext4. There are additional ext4 features, such as flex_bg and > 16TB filesystem support that can only be enabled at format time via mke2fs.
To change an ext2 filesystem (should you still have one) to ext3 (enabling the journal feature), use the command:
# tune2fs -j /dev/DEV
To enable the ext4 features on an existing ext3 filesystem, use the command:
# tune2fs -O extents,uninit_bg,dir_index /dev/DEV
WARNING: Once you run this command, the filesystem will no longer be mountable using the ext3 filesystem!
After running this command, you MUST run fsck to fix up some on-disk structures that tune2fs has modified:
# e2fsck -fD /dev/DEV
- by enabling the extents feature new files will be created in extents format, but this will not convert existing files to use extents. Non-extent files can be transparently read and written by Ext4.
- If you convert your root filesystem ("/") to ext4, and you use the GRUB boot loader, you will need to install a version of GRUB which understands ext4. Your system may boot OK the first time, but when your kernel is upgraded, it will become unbootable.
- WARNING: It is NOT recommended to resize the inodes using resize2fs with e2fsprogs 1.41.0 or later, as this is known to corrupt some filesystems.