Linux Convert ext3 to ext4 File system

Some time ago ext4 was released and available for Linux kernel. ext4 provides some additional benefits and perforce over ext3 file system. You can easily convert ext3 to ext4 file system. The next release of Fedora, 11, will default to the ext4 file system unless serious regressions are seen. In this quick tutorial you will learn about converting ext3 to ext4 file system.

ext4 Filesystem Features

The ext4 filesystem has more features and generally better performance than ext3, which is showing its age in the Linux filesystem world. Features include:

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
WARNING! Once you run following commands, the filesystem will no longer be mountable using the ext3. Please note that ext4 may have some bugs so do not use for production servers (wait for sometime watch Linux kernel mailing list for ext4 bugs). It’s recommended that you keep /boot in a ext3 partition for sometime.

You need ext4 patch applied into kernel and compile kernel with ext4 support. Once done type the following command to convert an existing ext3 filesystem to use ext4, type:
# tune2fs -O extents,uninit_bg,dir_index /dev/dev-name
For example convert /dev/sdb1 to ext4, enter:
# cd /; umount /dev/sdb1
# tune2fs -O extents,uninit_bg,dir_index /dev/sdb1

Next run fsck, enter:
# fsck -pf /dev/sdb1

How do I mount ext4 partition?

mount -t ext4 /dev/sdb1 /path
mount -t ext4 /dev/sdb1 /share
mount -t ext4 /dev/disk/by-uuid/YOUR-PARTITION-UUID /share

Use blkid to get UUID.

How do I boot from ext4 (/boot)?

If you have converted /boot file system (or / used for /boot), update /boot/grub.conf (/boot/grub/menu.lst). Open file and find out current kernel config file and append the following:
Here is sample config (note I’ve custom kernel names):

title		Ubuntu 8.10, kernel
root		(hd0,1)
kernel	/boot/vmlinuz- root=UUID=8c2da865-13f4-47a2-9c92-2f31738469e8 ro quiet splash rootfstype=ext4
initrd		/boot/initrd.img-

Save and close the file. And run update-grub:
$ sudo update-grub
Next, update your /etc/fstab file so that it can be mounted as ext4 file system:

UUID=41c22818-fbad-4da6-8196-c816df0b7aa8 	/share	ext4	defaults,errors=remount-ro,relatime 0       1

Finally, reboot the system:
$ sudo reboot

Further readings:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 21 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
21 comments… add one
  • Daniel Jan 23, 2009 @ 21:39

    I just did this in Intrepid the other day, but took a different approach. You may want to advise your readers that Grub won’t boot to an ext4 partition. Since I have a separate /boot, I just converted my / to ext4 with no problems.

    This is really simple actually, just requires a couple reboots:
    sudo nano /etc/fstab
    -change the fs type from ext3 to ext4dev for you root partition, the default options for ext4dev have extents enabled, so you cannot switch back to ext3
    sudo touch /forcefsck
    -this runs a fsck on reboot
    sudo reboot
    -let it run through the fsck, and once the system is up reboot again, it will need one more reboot and fsck to correct the journal
    -should list your partition as using ext4dev as the fs type

  • 🐧 nixCraft Jan 23, 2009 @ 22:08


    The post has been updated.

    Appreciate your comment.

  • Peter Jan 24, 2009 @ 3:51

    From your post it says a benefit of ext4 is Defragmentation support. What is happening here … I thought the benefit of linux file systems was that the files did not fragment ………. Are we about to see a flood of Windows style disk defragmenters?

  • Alec Jan 24, 2009 @ 15:11

    @ Peter:
    I agree. File system fragmentation???
    I’ve always enjoyed my linux clients and servers because I never had to schedule routine defragmentations like I have to do with Windows’ FAT and NTFS partitions…
    I will have to look into this some and experement.
    Thanks for the great post Vivek!

  • BobCFC Jan 24, 2009 @ 17:38

    Thanks I am using Ext4 with Jaunty Alpha 3 as my main system for / and /home partitions (using the Alternated CD) and it is so fast I don’t even notice that I enabled encryption for the whole home directory. Now I can convert my data partitions too!

    BTW I think the defrag feature refers to on-the-fly defragging while in use.

  • 🐧 nixCraft Jan 24, 2009 @ 17:51

    @ Peter / Alec

    BobCFC is correct about defragmentation. This new feature is called online fragmentation. Right now it is *NOT* available in v2.6.28, but will be probably available in the next release. Quoting from ext4 wiki:

    While delayed allocation, extents and multiblock allocation help to reduce the fragmentation, with usage filesystems can still fragment. For example: You write three files in a directory and continually on the disk. Some day you need to update the file of the middle, but the updated file has grown a bit, so there’s not enough room for it. You have no option but fragment the excess of data to another place of the disk, which will cause a seek, or allocate the updated file continually in another place, far from the other two files, resulting in seeks if an application needs to read all the files on a directory (say, a file manager doing thumbnails on a directory full of images). Besides, the filesystem can only care about certain types of fragmentation, it can’t know, for example, that it must keep all the boot-related files contiguous, because it doesn’t know which files are boot-related. To solve this issue, Ext4 will support online fragmentation, and there’s a e4defrag tool which can defragment individual files or the whole filesystem.

  • p-root Jan 27, 2009 @ 3:57

    Great knowledge base that i ever found…….. 🙂

  • Prakash Feb 25, 2009 @ 9:22

    Ext4 users are reporting few problems :
    and thread:

    Then ,we need e2fsprogs 1.41 or higher for ext4.kernel 2.6.28 for stable(eh?) ext4 unlike ext4dev.then converting a Linux root system from ext3 to ext4.Isn’t it risky with the current status of kernel support?

  • Shanker Jadapa Mar 5, 2009 @ 10:54

    First time i heard about ext4 file system. thanks for the information

  • Joachim Otahal Apr 26, 2009 @ 13:12

    In case of Debian lenny: the fs-type must be “ext4dev” in fstab, since debian does not yet consider ext4 stable enough to call it “ext4”, that will probably make it in sid.

  • Drew May 6, 2009 @ 23:17

    Oh yeah, when you reboot it seems to break a couple of desktop applets such as Quicklaunch (at least in my VM). And I did not notice an increase in boot times at all like so many have reported. Maybe it only applies to a fresh format ext4 w/ Ubuntu disc.

  • Joachim Otahal May 21, 2009 @ 10:38

    If you “convert” from ext3 to ext4 only new created files are “true” ext4, the existing files are still ext3-like, so existing files are as slow as usual, and deleting those files is as slow as usual too.
    Use fresh formatted ext4 or copy the files around (not move inside one partition!) will help.

  • brijesh Sep 10, 2009 @ 13:56

    i want to know depth of linux file system can you provide me detail matter..
    i am very much thankfull to you.
    your faithfully
    brijesh kumar
    allahabad (india)

  • hooborg Oct 26, 2009 @ 10:30

    In Redhat and Fedora there is /etc/grub.conf or /boot/grub/grub.conf not /boot/grub.conf (in How do I boot from ext4 (/boot)?)

  • Olivier Nov 27, 2009 @ 20:56

    I don’t understand why people are using ext3 or ext4 for /boot. Isn’t ext2 good enough ? Why the journaling would be useful for this partition ?

  • James Buergel Jan 4, 2010 @ 8:07

    Any more good web sites on ext 4 and or the new grub 2 ?

  • treah blade May 17, 2010 @ 2:07

    “How do I boot from ext4 (/boot)?”

    The info in this section is incorrect please do not use. See the grub wiki for correct details on how to modify a grub2 boot files.

  • matter Apr 8, 2011 @ 1:23

    Another reference advised to run fsck.ext4 with -D after tune2fs:

    fsck.ext4 -yfD /dev/sdc1

    Linas also advised enabling extents on all files / directories which will save the trouble of copying things around in order to achieve the full ext4 benefit. I used this after mounting the partition:

    find . -xdev -type f -print0 |
    while read -d $” FILE; do chattr +e “${FILE}”; done
    find . -xdev -type d -print0 |
    while read -d $” DIR; do chattr +e “${DIR}”; done


  • NP Oct 9, 2011 @ 10:38

    This is an incomplete tutorial if you read.

    Need to specify -D with the ext4 fsck for a start. See for info.

  • Nikolay Apr 3, 2012 @ 23:38

    was very helpful, old article, but well written.
    probably best descriptive article on this topic.
    My 1.3 TB filesystem is converted successfully.

  • navazkhan Dec 16, 2014 @ 12:16


    I want to convert my xfs file system to ext4 on CentOS 7 box. Please help me in this.


Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum