GNU Linux/Filesystems/Convert Ext3 to Ext4

From WhyAskWhy.org Wiki
Jump to: navigation, search




The following content is a Work In Progress and may contain broken links, incomplete directions or other errors. Once the initial work is complete this notice will be removed. Please contact me via Twitter with any questions and I'll try to help you out.


Related pages

GNU Linux/FilesystemsGNU Linux/Filesystems/Convert Ext3 to Ext4


Introduction

The Ext4 filesystem offers many benefits over the Ext3 filesystem and is the default filesystem for CentOS 6 and all currently supported LTS versions of Ubuntu.

Some of those benefits:

  • Delayed allocation & mballoc allocator for better on-disk allocation
  • Sub-second timestamps
  • Space preallocation
  • Journal checksumming
  • Large (>2T) file support
  • Large (>16T) filesystem support
  • Defragmentation support

At this point there is little reason to not use Ext4 over Ext3, particularly with the support for directly converting existing Ext3 filesystems to Ext4.


Directions

For these directions we're assuming that the root filesystem is on /dev/sda1

  1. Edit /etc/fstab
  2. Replace instances of ext3 with ext4
  3. reboot
  4. tune2fs -O extents,uninit_bg,dir_index /dev/sda1
  5. touch /forcefsck
  6. reboot
  7. Press F to force a filesystem check
    • see below for example output
  8. grub-install /dev/sda
  9. assuming /dev/sda1 is the primary block device holding the filesystem
  10. update-grub


Known issues

After you run tune2fs and force a fsck it prints many alarming messages to the screen. Here are some of those messages:

Group descriptor 239 checksum is invalid.  FIXED.

...

Group descriptor 266 checksum is invalid.  FIXED.
Pass1: Checking inodes, blocks and sizes

According to some light research those messages are normal as part of the conversion from Ext3 to Ext4.


References