How To Upgrade From Ext3 To Ext4 Without Formatting The Hard Disk

ext4Yesterday, we have discussed some of the new features in Ubuntu 9.04 Jaunty. In that article, I did mention that the new filesystem – ext4 is stable, fast and backward compatible with ext2 and ext3. Today, we will look at how you can upgrade your existing ext3 filesystem to ext4 without reformating your hard disk.

Disclaimer: Anything that deals with the filesystem hack always involve certain risks. While we have tested it out and get it working on our systems, there is no guarantee that it will work for you. We shall not be responsible for any data loss or hard disk crash. Before you try this, please remember to BACKUP your system and important files.

Step 1: Upgrade your existing Ubuntu

First for all, upgrade your existing Ubuntu to Ubuntu 9.04. You can skip this step if you have already upgraded to Ubuntu 9.04.

Press Alt + F2 on your keyboard and type in

update-manager -d

The Update Manager will appear. Click on the Upgrade button.

dist-upgrade

Depending on your Internet connection, the upgrade could last for several hours.

At the same time, proceed to Ubuntu website and download the Ubuntu 9.04 LiveCD iso.

After you have downloaded the LiveCD, burn it into a CD or use the USB Startup Disk Creator (System -> Administration -> USB Startup Disk Creator) to create a bootable USB drive.

Once the system completes the upgrading, restart your computer and play around with it to make sure that it is working fine in your system.

When you are happy with the result, reboot the computer again, this time boot into your LiveCD.

Step 2: Upgrading to Ext4

Go to System->Partition Editor. This will show all the partition in your hard disk. Record down the filesystem ID of the partition that you want to convert to ext4.

gparted

Close the Partition Editor. Open a terminal, type the following:

sudo tune2fs -O extents,uninit_bg,dir_index /dev/XXXX

Replace XXXX by the filesystem ID that you have recorded just now.

Once that is done, type the following to fixed your partition:

sudo fsck -pf /dev/XXXX

Don’t forget to replace XXXX with your filesystem ID.

Mount your filesystem

sudo mount -t ext4 /dev/XXXX /mnt

Open the fstab file:

gksu gedit /mnt/etc/fstab

and change the ext3 entry to ext4. Save and exit.

edit fstab

Back to the terminal, we need to reinstall the grub bootloader.

sudo grub-install /dev/XXX

This time, replace the XXX by the filesystem without the number. For example, sudo grub-install /dev/sda

Close the terminal and restart the computer. Reboot into ubuntu 9.04.

In the terminal, type

df -T

You should see your filesystem mounted as ext4 now

check filesystem type

That’s all. Enjoy!



Print this pageSave as PDF

Damien Oh is the owner and chief editor of Make Tech Easier
  • Pingback: Linx am 11. 4. 2009 bis 21. 4. 2009 | tuxtux

  • http://www.debian.org/ Debianero Rumbero

    As a disclaimer maybe you’d add that ext4 is ready in general but many user-land applications are not ready for ext4 yet.

  • http://www.debian.org Debianero Rumbero

    As a disclaimer maybe you’d add that ext4 is ready in general but many user-land applications are not ready for ext4 yet.

  • hussam al-tayeb

    did you just tell people to fsck a partition without unmounting it first?????

    • Icewind

      Yes, but he does tell you to use a live-cd, so the drive isn’t mounted in the first place.

      • http://djsonik.110mb.com/ djsonik

        Crap. I did it, and didn’t read the ‘use LiveCD’ part, because it was in the same step as upgrading to 9.04, which I already did, and just assumed that I should fsck it anyways, despite the warning. I was able to boot into ubuntu after a few tries, but stuff is acting weird. I might as well reinstall fresh… >_>

        I know it is completely my fault for not reading directions fully, but I think you should make the notice you need to use a LiveCD a little more prevalent for idiots like me. :P Otherwise, the article was well written. All things considered, at least I learned a lesson. :)

        djsonik

      • http://djsonik.110mb.com/ djsonik

        Crap. I did it, and didn’t read the ‘use LiveCD’ part, because it was in the same step as upgrading to 9.04, which I already did, and just assumed that I should fsck it anyways, despite the warning. I was able to boot into ubuntu after a few tries, but stuff is acting weird. I might as well reinstall fresh… >_>

        I know it is completely my fault for not reading directions fully, but I think you should make the notice you need to use a LiveCD a little more prevalent for idiots like me. :P Otherwise, the article was well written. All things considered, at least I learned a lesson. :)

        djsonik

  • hussam al-tayeb

    did you just tell people to fsck a partition without unmounting it first?????

    • Icewind

      Yes, but he does tell you to use a live-cd, so the drive isn’t mounted in the first place.

      • http://djsonik.110mb.com djsonik

        Crap. I did it, and didn’t read the ‘use LiveCD’ part, because it was in the same step as upgrading to 9.04, which I already did, and just assumed that I should fsck it anyways, despite the warning. I was able to boot into ubuntu after a few tries, but stuff is acting weird. I might as well reinstall fresh… >_>

        I know it is completely my fault for not reading directions fully, but I think you should make the notice you need to use a LiveCD a little more prevalent for idiots like me. :P Otherwise, the article was well written. All things considered, at least I learned a lesson. :)

        djsonik

  • shamil

    Just don’t use ext4 yet. It’s considered stable, but really is not. There is a risk of data loss currently.

  • shamil

    Just don’t use ext4 yet. It’s considered stable, but really is not. There is a risk of data loss currently.

  • shamil

    Just don’t use ext4 yet. It’s considered stable, but really is not. There is a risk of data loss currently.

  • Pingback: Ubuntu 9.04 Jaunty Jackalope sale mañana « Gabuntu

  • hussam al-tayeb

    Good, I see that now :)
    Great article then Damien :)

  • hussam al-tayeb

    Good, I see that now :)
    Great article then Damien :)

  • Pingback: IRC: #boycottnovell @ FreeNode: April 22nd, 2009 - Part 2 | Boycott Novell

  • Pingback: IRC: #boycottnovell @ FreeNode: April 22nd, 2009 - Part 2 | All about MICROSOFT

  • Pingback: Cómo pasar de ext3 a ext4 sin formatear | MuyLinux

  • Pingback: Nueva Version de Ubuntu 9.04 “Jaunty Jackalope” « Cristian Recabarren Ortiz

  • Pingback: Cómo pasar de ext3 a ext4 sin formatear « Tecnologia, Actualidad,y mucho mas….

  • Pingback: Linux » Blog Archive » Cómo pasar de ext3 a ext4 sin formatear

  • Pingback: Nueva Version de Ubuntu 9.04 “Jaunty Jackalope” « Cristian Recabarren Ortíz

  • Jarige

    Nice guide! Only it ruined my /home partition. I can now boot, but when I log in, it gives some error about /home/jarik (jarik is login name) not available or something, en then I click Yes or No. One of them will log me in, but only a blue screen appears (Blue is the color setting of the login screen) and nothing happens.
    I have followed all steps, exept for the gksu gedit /mnt/etc/fstab because that file was somehow empty :O
    I got a dual boot Vista/Ubuntu 9.04. Vista is on C:\ (sda1) I’ve got a second harddrive D:\ (sdb) for Data and an HP_recovery (E:\ or sda2).
    Ubuntu is installed on my external harddrive (sdc) and has got an NTFS partition for Windows (250GB sdc1 ) a swapfile for Linux (2GB sdc3) and \home partition (which is screwed up, 50GB sdc2) and of course where ubuntu is installed (8GB sdc5)
    And somehow there’s a sdc4 linking to sdc5 (it has always been there)

    Can anyone help me getting my account back on plz?
    Luckily I decided to backup most important data to my DATA drive :D
    If there’s anything I can do for you to help me better, just ask me.

    • http://maketecheasier.com Damien

      Your situation is a bit more complicated, because you have plenty of partition.

      My suggestion:

      Boot into LiveCD.

      Open a terminal, (assuming your sdc5 is the filesystem folder and is in ext3 format)

      sudo mount -t ext3 /dev/sdc5 /mnt

      gksu gedit /mnt/etc/fstab

      and change the ext3 entry to ext4 (only for the /home partition). Save and exit.

      Reboot the computer.

  • Jarige

    Nice guide! Only it ruined my /home partition. I can now boot, but when I log in, it gives some error about /home/jarik (jarik is login name) not available or something, en then I click Yes or No. One of them will log me in, but only a blue screen appears (Blue is the color setting of the login screen) and nothing happens.
    I have followed all steps, exept for the gksu gedit /mnt/etc/fstab because that file was somehow empty :O
    I got a dual boot Vista/Ubuntu 9.04. Vista is on C: (sda1) I’ve got a second harddrive D: (sdb) for Data and an HP_recovery (E: or sda2).
    Ubuntu is installed on my external harddrive (sdc) and has got an NTFS partition for Windows (250GB sdc1 ) a swapfile for Linux (2GB sdc3) and home partition (which is screwed up, 50GB sdc2) and of course where ubuntu is installed (8GB sdc5)
    And somehow there’s a sdc4 linking to sdc5 (it has always been there)

    Can anyone help me getting my account back on plz?
    Luckily I decided to backup most important data to my DATA drive :D
    If there’s anything I can do for you to help me better, just ask me.

    • http://maketecheasier.com/ Damien

      Your situation is a bit more complicated, because you have plenty of partition.

      My suggestion:

      Boot into LiveCD.

      Open a terminal, (assuming your sdc5 is the filesystem folder and is in ext3 format)

      sudo mount -t ext3 /dev/sdc5 /mnt

      gksu gedit /mnt/etc/fstab

      and change the ext3 entry to ext4 (only for the /home partition). Save and exit.

      Reboot the computer.

    • http://maketecheasier.com/ Damien

      Your situation is a bit more complicated, because you have plenty of partition.

      My suggestion:

      Boot into LiveCD.

      Open a terminal, (assuming your sdc5 is the filesystem folder and is in ext3 format)

      sudo mount -t ext3 /dev/sdc5 /mnt

      gksu gedit /mnt/etc/fstab

      and change the ext3 entry to ext4 (only for the /home partition). Save and exit.

      Reboot the computer.

  • Jarige

    This screwed up my /home partition. I did everything exept for the grub install and ‘gksu gedit /mnt/etc/fstab’. fstab was empty somehow, so I couln’t edit that.
    I converted my /home partition and my installation partition to ext4.
    If there’s anything I can do to help you help me better, plz ask me!

    • jimbob

      I believe the fstab is located in /etc/ so try ‘gksu gedit /etc/fstab’

  • Jarige

    This screwed up my /home partition. I did everything exept for the grub install and ‘gksu gedit /mnt/etc/fstab’. fstab was empty somehow, so I couln’t edit that.
    I converted my /home partition and my installation partition to ext4.
    If there’s anything I can do to help you help me better, plz ask me!

    • jimbob

      I believe the fstab is located in /etc/ so try ‘gksu gedit /etc/fstab’

  • Ubuntufan

    Thank you for sharing your experience.

  • Ubuntufan

    Thank you for sharing your experience.

  • Pingback: wangyingqi’s blog » Ubuntu???????ext3?ext4

  • http://ubuntu-inside.blogspot.com/ Giorgio Beltrammi

    Hi everybody,
    this useful, and well done article, was translated in Italian language and published in Ubuntu-Inside italian Blog.

    http://ubuntu-inside.blogspot.com/2009/04/aggiornare-da-ext3-ext4-senza.html

    I want to thank you :-)

  • http://ubuntu-inside.blogspot.com/ Giorgio Beltrammi

    Hi everybody,
    this useful, and well done article, was translated in Italian language and published in Ubuntu-Inside italian Blog.

    http://ubuntu-inside.blogspot.com/2009/04/aggiornare-da-ext3-ext4-senza.html

    I want to thank you :-)

  • http://ubuntu-inside.blogspot.com Giorgio Beltrammi

    Hi everybody,
    this useful, and well done article, was translated in Italian language and published in Ubuntu-Inside italian Blog.

    http://ubuntu-inside.blogspot.com/2009/04/aggiornare-da-ext3-ext4-senza.html

    I want to thank you :-)

  • Pingback: HowtoMatrix » How To Upgrade From Ext3 To Ext4 Without Formatting The Hard Disk

  • http://blog.ejbca.org/ Tomas Gustavsson

    I have an entryped root partition on my laptop, installed with the ubuntu alternate CD. Everyone should run full disk encryption right :-).
    Anyway I figured out how to mount the encrypted partition as well, See http://blog.ejbca.org/2009/04/migrating-ext3-to-ext4-on-encrypted.html

    After setting up cryptsetup and lvm the commands above works just perfect.

  • http://blog.ejbca.org/ Tomas Gustavsson

    I have an entryped root partition on my laptop, installed with the ubuntu alternate CD. Everyone should run full disk encryption right :-).
    Anyway I figured out how to mount the encrypted partition as well, See http://blog.ejbca.org/2009/04/migrating-ext3-to-ext4-on-encrypted.html

    After setting up cryptsetup and lvm the commands above works just perfect.

  • http://blog.ejbca.org/ Tomas Gustavsson

    I have an entryped root partition on my laptop, installed with the ubuntu alternate CD. Everyone should run full disk encryption right :-).
    Anyway I figured out how to mount the encrypted partition as well, See http://blog.ejbca.org/2009/04/migrating-ext3-to-ext4-on-encrypted.html

    After setting up cryptsetup and lvm the commands above works just perfect.

  • http://blog.ejbca.org/ Tomas Gustavsson

    I have an encrypted root filesystem installed with the alternate ubuntu installer. After figuring out how to set up cryptsetup and lvm from the live cd the commands above works prefect. See http://blog.ejbca.org/2009/04/migrating-ext3-to-ext4-on-encrypted.html.

  • http://blog.ejbca.org/ Tomas Gustavsson

    I have an encrypted root filesystem installed with the alternate ubuntu installer. After figuring out how to set up cryptsetup and lvm from the live cd the commands above works prefect. See http://blog.ejbca.org/2009/04/migrating-ext3-to-ext4-on-encrypted.html.

  • http://blog.ejbca.org/ Tomas Gustavsson

    I have an encrypted root filesystem installed with the alternate ubuntu installer. After figuring out how to set up cryptsetup and lvm from the live cd the commands above works prefect. See http://blog.ejbca.org/2009/04/migrating-ext3-to-ext4-on-encrypted.html.

  • http://www.googez.com/ Linuxfun

    Thank you for this usefull how to.

  • http://www.googez.com Linuxfun

    Thank you for this usefull how to.

  • Jarige

    Ok, my problem is solved now. I’m running Ubuntu 9.04 on Ext4 :D
    I actually figured it out myself by trying gksu gedit /mnt/etc/fstab again, and this time it did show the file I should have editted in the first place.
    Thank you for the help :D
    Great guide, but should have been a bit more clear on part when you should insert the LiveCD.

  • Jarige

    Ok, my problem is solved now. I’m running Ubuntu 9.04 on Ext4 :D
    I actually figured it out myself by trying gksu gedit /mnt/etc/fstab again, and this time it did show the file I should have editted in the first place.
    Thank you for the help :D
    Great guide, but should have been a bit more clear on part when you should insert the LiveCD.

  • http://maketecheasier.com/how-to-upgrade-from-ext3-to-ext4-without-formatting-the-hard-disk/2009/04/21 Rex Mundi

    I followed exactly what you recommented. It worked, perfectly, Thanks.

  • http://maketecheasier.com/how-to-upgrade-from-ext3-to-ext4-without-formatting-the-hard-disk/2009/04/21 Rex Mundi

    I followed exactly what you recommented. It worked, perfectly, Thanks.

  • http://maketecheasier.com/how-to-upgrade-from-ext3-to-ext4-without-formatting-the-hard-disk/2009/04/21 Rex Mundi

    It worked perfectly.

  • http://maketecheasier.com/how-to-upgrade-from-ext3-to-ext4-without-formatting-the-hard-disk/2009/04/21 Rex Mundi

    I followed exactly what you recommented. It worked, perfectly, Thanks.

  • http://maketecheasier.com/how-to-upgrade-from-ext3-to-ext4-without-formatting-the-hard-disk/2009/04/21 Rex Mundi

    It worked perfectly.

  • Pingback: ?? Ext3 ? Ext4 » sshlog

  • Carlos

    I upgraded my / and /home partitions successfully. Hovewer, I had an error when reinstalling grub with the suggested command (sudo grub-install /dev/XXX). Grub complained about not finding the /boot directory corresponding to that partition. To circumvent the error, I used:

    sudo grub-install –root-directory=/mnt /dev/XXX

    • http://tengounblogen.blogspot.com/ Raúl

      Thanks a lot Carlos.. that tip help me a lot… I feel like @djsonik… I feel so stupid because I don’t read carefully this great post…

      Muchas gracias, espero que me entiendas… me había comenzado a preocupar cuando me apareció ese problema con el boot…

    • http://tengounblogen.blogspot.com/ Raúl

      Thanks a lot Carlos.. that tip help me a lot… I feel like @djsonik… I feel so stupid because I don’t read carefully this great post…

      Muchas gracias, espero que me entiendas… me había comenzado a preocupar cuando me apareció ese problema con el boot…

    • vpxavier

      Thank you for the How-to Damien.
      I had the error described by Carlos with ubuntu 9.04 installed on ext3 that I wanted to upgrade to ext4.

      @Carlos: thank you for your tip that solved my problem but the correct command is not “sudo grub-install –root-directory=/mnt /dev/XXX” but “sudo grub-install –root-directory=/mnt /dev/XXX”

    • vpxavier

      Thank you for the How-to Damien.
      I had the error described by Carlos with ubuntu 9.04 installed on ext3 that I wanted to upgrade to ext4.

      @Carlos: thank you for your tip that solved my problem but the correct command is not “sudo grub-install –root-directory=/mnt /dev/XXX” but “sudo grub-install –root-directory=/mnt /dev/XXX”

  • Carlos

    I upgraded my / and /home partitions successfully. Hovewer, I had an error when reinstalling grub with the suggested command (sudo grub-install /dev/XXX). Grub complained about not finding the /boot directory corresponding to that partition. To circumvent the error, I used:

    sudo grub-install –root-directory=/mnt /dev/XXX

    • http://tengounblogen.blogspot.com/ Raúl

      Thanks a lot Carlos.. that tip help me a lot… I feel like @djsonik… I feel so stupid because I don’t read carefully this great post…

      Muchas gracias, espero que me entiendas… me había comenzado a preocupar cuando me apareció ese problema con el boot…

    • vpxavier

      Thank you for the How-to Damien.
      I had the error described by Carlos with ubuntu 9.04 installed on ext3 that I wanted to upgrade to ext4.

      @Carlos: thank you for your tip that solved my problem but the correct command is not “sudo grub-install –root-directory=/mnt /dev/XXX” but “sudo grub-install –root-directory=/mnt /dev/XXX”

  • http://bichopro.blogspot.com/ Bicho Pro

    Excuse my bad English…

    Work 99% on my laptop with jaunty. Just when is necessary reinstall grub, the command return something like no drive, or not bios, something like that, but i type the Carlos command and reboot…

    Im happy now with ext4 and my data is safe, thanks for the tutorial.

    Too many thanks from Chile

  • http://bichopro.blogspot.com/ Bicho Pro

    Excuse my bad English…

    Work 99% on my laptop with jaunty. Just when is necessary reinstall grub, the command return something like no drive, or not bios, something like that, but i type the Carlos command and reboot…

    Im happy now with ext4 and my data is safe, thanks for the tutorial.

    Too many thanks from Chile

  • http://bichopro.blogspot.com Bicho Pro

    Excuse my bad English…

    Work 99% on my laptop with jaunty. Just when is necessary reinstall grub, the command return something like no drive, or not bios, something like that, but i type the Carlos command and reboot…

    Im happy now with ext4 and my data is safe, thanks for the tutorial.

    Too many thanks from Chile

  • Pingback: Pasar de ext3 a ext4 sin formatear | Snapcodex

  • leonidas

    But, how would one go to convert his ‘/’ partition (that he setup as ext4 when installing Jaunty), BACK to ext3 without losing data, or the OS in general?

    I have my /home as ext3 (from previous hardy installation) and when I installed jaunty I setup / as ext4, but the system is very very unstable, and I’m thinking that is the issue.

  • leonidas

    But, how would one go to convert his ‘/’ partition (that he setup as ext4 when installing Jaunty), BACK to ext3 without losing data, or the OS in general?

    I have my /home as ext3 (from previous hardy installation) and when I installed jaunty I setup / as ext4, but the system is very very unstable, and I’m thinking that is the issue.

  • http://www.ejbca.org/ Tomas

    Kernel 2.6.28 in Jaunty seems to be unstable on a lot of systems. I reinstalled my system with ext3 cause I though ext4 made it unstable, but it was the kernel. Now I’m running 2.6.17 instead of 28 and it’s working fine (with ext3 though).

  • http://www.ejbca.org/ Tomas

    Kernel 2.6.28 in Jaunty seems to be unstable on a lot of systems. I reinstalled my system with ext3 cause I though ext4 made it unstable, but it was the kernel. Now I’m running 2.6.17 instead of 28 and it’s working fine (with ext3 though).

  • http://www.ejbca.org/ Tomas

    Kernel 2.6.28 in Jaunty seems to be unstable on a lot of systems. I reinstalled my system with ext3 cause I though ext4 made it unstable, but it was the kernel. Now I’m running 2.6.17 instead of 28 and it’s working fine (with ext3 though).

  • Roland

    I installed 9.04 and followed your instructions and it works great
    Thank you.

    • http://maketecheasier.com/ Damien

      I am glad it works great for you.

  • Roland

    I installed 9.04 and followed your instructions and it works great
    Thank you.

    • http://maketecheasier.com Damien

      I am glad it works great for you.

  • cocolocko

    Works great on my actual upgradet Ubuntu v9.04 64bit!
    Thank you and go ahead ;)

    Greetings

  • cocolocko

    Works great on my actual upgradet Ubuntu v9.04 64bit!
    Thank you and go ahead ;)

    Greetings

  • Zoowey

    Absolutely great guide. However, I should note that if you also want to convert your /home partition, once you mount it and run “gksu gedit /mnt/etc/fstab” you will be greeted with a blank fstab. I recommend you change both your /home and root partition in the fstab to ext4 after mounting the root partition then continue on to converting the /home partition.

  • Zoowey

    Absolutely great guide. However, I should note that if you also want to convert your /home partition, once you mount it and run “gksu gedit /mnt/etc/fstab” you will be greeted with a blank fstab. I recommend you change both your /home and root partition in the fstab to ext4 after mounting the root partition then continue on to converting the /home partition.

  • Zoowey

    Absolutely great guide. However, I should note that if you also want to convert your /home partition, once you mount it and run “gksu gedit /mnt/etc/fstab” you will be greeted with a blank fstab. I recommend you change both your /home and root partition in the fstab to ext4 after mounting the root partition then continue on to converting the /home partition.

  • Pingback: Linx am 11. 4. 2009 bis 21. 4. 2009 - testomat

  • Pingback: Ronaldo Richieri » links for 2009-07-12

  • Pingback: links for 2009-07-18 « Where Is All This Leading To?

  • Pingback: Ext3 or ext4? That and upgrading to Jaunty | ProDevTips - dev notes and tutorials

  • Pingback: ???? ?? ?????? ????? ???? ??????? ??? ex4 - ????? ?????? ?????

  • m3wt

    it worked!! thank you thank you thank you!!!!

  • m3wt

    it worked!! thank you thank you thank you!!!!

  • http://xyepblra.livejournal.com/ CTAC

    Worked for me on the forth attempt, thank you!
    My question is, my root and home are on different partitions, so now I need help converting /home file system to ext4.

  • http://xyepblra.livejournal.com/ CTAC

    Worked for me on the forth attempt, thank you!
    My question is, my root and home are on different partitions, so now I need help converting /home file system to ext4.

  • http://xyepblra.livejournal.com CTAC

    Worked for me on the forth attempt, thank you!
    My question is, my root and home are on different partitions, so now I need help converting /home file system to ext4.

  • Pingback: links for 2009-10-30 « Caiwangqin’s delicious bog

  • Pingback: De Ext3 a Ext4 sense formatejar el sistema de fitxers « Microwordpress de @jrosell

  • Pingback: Screenshots Tour of Ubuntu Karmic Koala 9.10 Beta – Make Tech Easier