Ext4

Ext4 is the next generation of the Ext filesystem series. It supports much larger disks as well as nanosecond timestamps and extents. For more information see http://kernelnewbies.org/Ext4

Prerequisites
The linux kernel code for mounting ext4 was marked stable (name changed from ext4dev to ext4) in version 2.6.28. You will need a recent version of e2fsprogs; at least version 1.41. You may choose to use either the stable or the testing version, but the testing version may have updates that fix problems related to ext4, since it is rather new.

Installation
Once you have installed the prerequisites, you may continue by emerging the >=2.6.29 kernel.

Configuring the kernel
Only one kernel option must be enabled to use ext4:

If you have used the development version of ext4 (ext4dev) make sure you enable that option. If you have only newly-created filesystems (created with the 2.6.28 or later version of ext4), then you don't need the ext4dev option.

Extended attributes and POSIX ACLs only need to be enabled if you intend to make use of them, which is entirely optional.

If you plan to mount an ext4 filesystem with the huge_file feature set on a 32bit kernel, which is enabled by default by mkfs.ext4, you need this option, too. 64bit kernels support this by default.

To get rid of the "huge_file" default (which is only useful if you intend to have individual files larger than 2 Terabytes), edit the file "/etc/mke2fs.conf" before creating your ext4 filesystems. Once a filesystem is created with huge_file enabled, you will need the feature enabled in the kernel in order to access it. The "huge_file" feature set uses a wider inode index, resulting in unnecessarily large inodes and superblocks. Although the difference is minor, and there have been no reports of performance degradation, logic dictates the potential is there for an incremental performance penalty. Also, huge_file is a relatively new feature that will be under active development during the transition to btrfs. (So I for one have opted out, given that I don't have any 2TB+ files.)

Although it is enabled by default, you can get rid of it by changing "huge_file" to "large_file" in the "ext4" block of /etc/mke2fs.conf (the section that begins with "ext4 = {"). If you have ext4dev support enabled in the kernel, you would want to make the change in the ext4dev block as well.

If all your ext4 filesystems are created without the huge_file feature set enabled, then you don't need it in your kernel. Alternatively, you may want to switch the default from "huge_file" to "large_file" (as above), but leave support enabled in the kernel (this gives you the option to enable it in the command line later, if you suddenly get an irrepressable urge to create a 2+ TB file, or in case a friend drops by with a 2+ TB file on a USB drive or something).

Creating a new Ext4 filesystem
If you have a partition that you just want to make a new filesystem on, you can simply run:

where device is the name of the block device where you want to put the partition.

Converting an ext3 filesystem to ext4
since ext4 is backwards compatible, you can mount an ext3 partition as ext4:

where device is the device you want to mount, and mountpoint is where you want to mount it.

The filesystem will not, however, use many of the new features of ext4. You can enable those with the following (make sure to unmount the filesystem first if it's mounted):

It is important that you then run fsck, to make sure everything is ok: