Ext4 Howto

From Ext4
Revision as of 12:06, 17 August 2008 by Tytso (Talk | contribs)

Jump to: navigation, search

Contents

General Information

As of this writing (mid-July, 2008, just after the release of 2.6.26), the ext4 code is functionally complete and functional enough that a few people are using it in production. However, it is still being tested and although the developers haven't lost any data yet, please be cautious and keep plenty of backups!

Note: there are some known bugs that cause crashes if you try to delete non-extent files (from a filesystem that previously for ext3 and then converted to ext4 via "tune2fs -E test_fs -O extents /dev/XXX") that will cause a kernel crash. Fixes are available in the ext4 patch queue (the two patches in question are ext4-fix-no-extent-truncate-i_prealloc-bug and fix-delalloc-release-block-reservation-for-truncate), but haven't been released in a patchset yet. (A new patchset release should happen very shortly, in the next few days.) These two bugs will not trigger on a freshly created ext4 filesystem using "mke2fs -t ext4dev" --- but please see the caution below about installing mke2fs.conf from e2fsprogs 1.41.0; this is very important!

The ext4 developers can be contacted at the ext4 mailing list. They are sometimes also can be found on IRC.

Getting Ext4 code

For people who build their own kernel

1. Start with a 2.6.26 kernel. It is highly recommended that you apply the 2.6.26-ext4-6 patchset to get improved performance through delayed allocation as well as the latest bug fixes. In your kernel's .config file, enable EXT4DEV_FS (along with EXT4DEV_FS_XATTR and EXT4DEV_FS_POSIX_ACL if you like).

2. Compile the latest version of e2fsprogs (as of this writing 1.41.0) 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 9 currently has a kernel based on 2.6.25 that has basic ext4 support. (It is missing some of the latest fixes and performance optimizations, such as delayed allocation.) A 2.6.26 kernel update should be available reasonably soon, with more up-to-date ext4 code, though still missing delayed allocation, which should arrive in 2.6.27.

Fedora 9 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.

For people who are running Ubuntu

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 reason for some unknown reason. For other versions of Ubuntu, the patch that was applied can be found here.

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 ext4dev /dev/DEV

Once the filesystem is created, it can be mounted as follows:

       $ mount -t ext4dev /dev/DEV /wherever

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). > 16T support is one of the very next high-priority features to complete for ext4.

Converting an ext3 filesystem to ext4

To convert an existing ext3 filesystem to use ext4, use the command

       $ tune2fs -O extents -E test_fs /dev/DEV

NOTE: by doing so, new files will be created in extents format, but this will not convert existing files. However, they can be transparently read from and written to in the old ext3 format.

If the filesystem was created with 128 byte inodes, it can be converted to use 256 byte for greater efficiency via:

       $ tune2fs -I 256 /dev/DEV

NOTE: Recent mkfs.ext3 now defaults to 256-byte inodes, so newer distributions (Fedora 9 included) will have already created 256-byte inode filesystems.

WARNING: Once the extent feature has been turned on, the filesystem will no longer be mountable using the ext3 filesystem!

Personal tools