From ArchWiki
Revision as of 18:21, 25 May 2009 by Boyska (Talk | contribs)

Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end


Ext4 is the evolution of the most used Linux filesystem, Ext3. In many ways, Ext4 is a deeper improvement over Ext3 than Ext3 was over Ext2. Ext3 was mostly about adding journaling to Ext2, but Ext4 modifies important data structures of the filesystem such as the ones destined to store the file data. The result is a filesystem with an improved design, better performance, reliability, and features.

Source: Ext4 - Linux Kernel Newbies

Creating ext4 Partitions From Scratch

  1. Upgrade your system: Template:Codeline
  2. Format the partition: Template:Codeline (see the mkfs.ext4 man page for options)
  3. Mount the partition
  4. Add an entry to Template:Filename, using the filesystem 'type' ext4

Migrating From ext3 to ext4

There are two ways of migrating partitions from ext3 to ext4:

  • mounting ext3 partitions as ext4 without converting (compatibility)
  • converting ext3 partitions to ext4 (performance)

These two approaches are described below.

Mounting ext3 Partitions as ext4 Without Converting


A compromise between fully converting to ext4 and simply remaining with ext3 is to mount existing ext3 partitions as ext4.


  • Compatibility (the filesystem can continue to be mounted as ext3) – This allows users to still read the filesystem from other distributions/operating systems without ext4 support (e.g. Windows with ext3 drivers)
  • Improved performance (though not as much as a fully-converted ext4 partition) – See Ext4 - Linux Kernel Newbies for details


  • Fewer features of ext4 are used (only those that do not change the disk format such as multiblock allocation and delayed allocation)
Note: Except for the relative novelty of ext4 (which can be seen as a risk), there is no major drawback to this technique.


  1. Edit Template:Filename and change the 'type' from ext3 to ext4 for any partitions you would like to mount as ext4.
  2. Re-mount the affected partitions.
  3. That's all, folks!

Converting ext3 Partitions to ext4


To fully experience the joys of ext4, an irreversible conversion process must be completed.



  • Cannot be read/written with ext3 drivers (note that there is no known ext4 driver for Windows)
  • Irreversible (ext4 partitions cannot be 'downgraded' to ext3)


The following software is required on the Arch Linux system:

If converting one's /boot partition to ext4:

Note: The ext4 patch is included by default with Arch's GRUB package (at the time of writing, but this will likely not change). Otherwise, GRUB2 is required for booting from an ext4 partition.
Warning: Booting from an ext4 partition is not 'officially' supported by GRUB, and GRUB2 is still under development. While GRUB does currently work, the 'safe' option is to boot from an ext2 or ext3 /boot partition. CONSIDER YOURSELF WARNED!

If converting one's root (/) partition to ext4:

If converting one's root (/) partition to ext4, the following software is also needed on a bootable CD/USB drive:

Note: Using the latest Arch Linux release (2009.02) is recommended. Older Arch Linux images (<= 2008.06) ship with an older version of Template:Codeline, but it is a simple matter to Template:Codeline from the live environment after setting up networking. Alternatively, SystemRescueCd >= 1.1.4 contains an appropriate version, and is in itself a handy CD to have.


These instructions were adapted from http://ext4.wiki.kernel.org/index.php/Ext4_Howto and http://bbs.archlinux.org/viewtopic.php?id=61602. They have been tested and confirmed by this author as of January 16, 2009.

  • UPGRADE! Perform a sysupgrade to ensure all required packages are up-to-date: Template:Codeline
  • BACK-UP! Back-up all data on any ext3 partitions that are to be converted to ext4. Although ext4 is considered 'stable' for general use, it is still a relatively young and untested file system. Furthermore, this conversion process was only tested on a relatively simple setup; it is impossible to test each of the many possible configurations the user may be running.
  • Edit Template:Filename and change the 'type' from ext3 to ext4 for any partitions that are to be converted to ext4.
Warning: ext4 is backwards-compatible with ext3 until extents and other new fancy options are enabled. If the user has a partition that is shared with another OS that cannot yet read ext4 partitions, it is possible to mount said partition as ext4 in Arch and still be able to use it as ext3 elsewhere at this point... Not so after the next step! Note, however, that there are fewer benefits to using ext4 if the partition is not fully converted.
  • The conversion process with Template:Codeline must be done when the drive is not mounted. If converting one's root (/) partition, the simplest way to achieve this is to boot from some other live medium, as described in the 'Prerequisites' section above.
Note: The user MUST fsck the filesystem, or it will be unreadable! This fsck run is needed to return the filesystem to a consistent state. It WILL find checksum errors in the group descriptors -- this is expected. The '-f' parameter asks fsck to force checking even if the file system seems clean. The '-p' parameter asks fsck to 'automatically repair' (otherwise, the user will be asked for input for each error).
  • Reboot Arch Linux!
Warning: If the user converted their root (/) partition, a kernel panic may be encountered when attempting to boot. If this happens, simply reboot using the 'fallback' initial ramdisk and re-create the 'default' initial ramdisk: Template:Codeline


Kernel Panic

One problem this author encountered was a kernel panic after converting the root (/) partition to ext4. This is because the initial ramdisk was detecting the partition as 'ext4dev', rather than 'ext4'. It was a simple matter to boot with the 'fallback' initial ramdisk and re-create the 'default' initial ramdisk:

# mkinitcpio -p kernel26

During the creation process, Template:Codeline correctly detected and included ext4 modules in the initial ramdisk.

GRUB Error 13

After a recent kernel update, this author encountered a GRUB error while attempting to boot from an ext4 /boot partition:

Error 13: Invalid or unsupported executable format

The solution is to boot from the live medium and chroot into the Arch Linux installation:

# mkdir /mnt/arch
# mount -t ext4 /dev/sda1 /mnt/arch
# mount -t proc proc /mnt/arch/proc
# mount -t sysfs sys /mnt/arch/sys
# mount -o bind /dev /mnt/arch/dev
# chroot /mnt/arch /bin/bash

If /boot is on a separate partition, this partition must also be mounted:

# mount -t ext4 /dev/sda2 /boot

Then, the following command should resolve the issue. (Does anyone know why?):

# grub-install --recheck /dev/sda

Data Corruption

If data corruption is encountered after a hard reboot, one user found that adding Template:Codeline to their Template:Codeline line in GRUB's Template:Filename helped resolve the issue.

(It was not specified whether this recovered the corrupt data or whether it simply helped prevent future corruption.) It happened to me and it didn't recover the corrupt data -- Boyska

Please read Ext4 data loss; explanations and workarounds for more information.