Page 1 of 5 123 ... LastLast
Results 1 to 10 of 50

Thread: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

  1. #1
    Join Date
    Jun 2007
    Location
    The Netherlands
    Beans
    1,278
    Distro
    Ubuntu Development Release

    HOWTO: Convert your ext2/ext3 file system to ext4 (in Jaunty)

    With the release of Jaunty allot of people will be doing an upgrade from Intrepid (if they did not do it already) to Jaunty. If you are one of those people and you don't want to miss out using the new ext4 file system, there is a way to convert your existing ext2 and/or ext3 file system to ext4.

    Please note that converting-to/using ext4 is by no means necessary, you are not missing out if you are using ext3 (hell, ext2 is still widely in use). So only do this if you like to hack and get your hands dirty. I did however convert my production machine from ext3 to ext4 just because I wanted to


    Step one:
    Upgrade to Jaunty. You now have a working Jaunty install running the ext3 file system.
    Make sure you are running kernel 2.6.28-11-generic or higher.
    To check which kernel you are running:
    Code:
    uname -a
    Step two:
    Make a backup of all your (important) data.

    Step three:
    EDIT: Some extra info on how to convert from ext2 to ext4 (thanks, groggyboy)

    Boot from a (Jaunty) live-cd and run the following code (in this example the partition to convert is on /dev/sda1) to convert the partition:
    To convert from ext3 to ext4:
    Code:
    sudo bash
    tune2fs -O extents,uninit_bg,dir_index /dev/sda1
    e2fsck -pf /dev/sda1
    To convert from ext2 to ext4:
    Code:
    sudo bash
    tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/sda1
    e2fsck -pf /dev/sda1
    Step four:
    Mount the partition and change the type of the converted partition in fstab:
    Code:
    sudo bash
    mount -t ext4 /dev/sda1 /mnt
    nano /mnt/etc/fstab
    change "ext3" to "ext4" like in the example below:
    Code:
    # /dev/sda1
    UUID=XXXXXXXXXXXXXXXXXXXXXXXXXX /               ext3    relatime,errors=remount-ro 0       1
    change it to:
    Code:
    # /dev/sda1
    UUID=XXXXXXXXXXXXXXXXXXXXXXXXXX /               ext4    relatime,errors=remount-ro 0       1
    and save the changes.

    Step five:
    EDIT: Some extra info on how to refresh grub when you have a separate /boot partition (thanks, utkjamie)

    This step might be optional but when I upgraded from Intrepid to Jaunty the upgrade process did not install/update the new grub stage. So if you don't run either of the following code examples you might get an (fatal) error 13 when booting the machine.
    Use this code to refresh grub when you do not have a separate /boot partition (in this example the root partition is sda1)
    Code:
    sudo bash
    mount /dev/sda1 /mnt
    grub-install /dev/sda --root-directory=/mnt --recheck
    Use this code to refresh grub when you do have a separate /boot partition (in this example the /boot partition is sda1)
    Code:
    sudo bash
    mkdir /mnt/boot
    mount /dev/sda1 /mnt/boot
    grub-install /dev/sda --root-directory=/mnt --recheck
    That's it, after you reboot you you will be running from an ext4 file system.
    As a side note, all the files that where present before the conversion will not benefit from the conversion as they were written to disk using ext3 technology. Only newly created or overwritten files will be using the true ext4 technology (so now, using update-manager will be extra beneficial ). As ext3 and ext4 are compatible with each other having files written to disk in ext3 mode on your ext4 file system do not impose any risks (and most if not all ext3 sectors could eventually disappear even without defragging).

    There is currently a online-defragging tool in development (e4defrag) which should be available with the next kernel release.
    Last edited by whoop; May 11th, 2009 at 11:15 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Winnipeg, Canada
    Beans
    365
    Distro
    Ubuntu Intrepid Ibex (testing)

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    Thanks for the howto! Worked like a charm for me.

    However, I upgraded from ext2 to ext4. I made one modification to step three in order to make the upgrade, and I thought I'd share it:

    Step three (when upgrading from ext2 to ext4):
    Code:
    sudo bash
    tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/sda1
    e2fsck -pf /dev/sda1
    The extra flag, "has_journal", is nescessary because ext2 is not a journalling filesystem, unlike the later ext filesystems.
    last.fm: the social music revolution.

  3. #3
    Join Date
    Mar 2009
    Location
    Tulsa
    Beans
    12
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    works perfectly thanks for the info

  4. #4
    Join Date
    Jan 2009
    Location
    Falkirk, Scotland.
    Beans
    236
    Distro
    Ubuntu Development Release

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    THANKS ;D

    i'll use this tomorow when 9.04 is released on my netbook because it dowsnt have a cd drive and i dont have a flash drive around i cant do a clean install.

    i love you

  5. #5
    Join Date
    Apr 2007
    Beans
    307
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    Is there away of doing this that doesn't rely on booting from the live CD ?

    (I have to install Ubuntu using the alternative CD because my computer spec doesn't meet the requirements to boot from live CD.)
    'I am writing to you, knowing that you will do even more than I ask.'

  6. #6
    Join Date
    Jun 2007
    Location
    Maryland, U.S.A.
    Beans
    202
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    Thank you very much for this! I was worried I'd have to backup my data and scrap my install to get ext4.
    The past is the past. If I look back, I am lost. --Daenerys Targaryen (modified by me)

  7. #7
    Join Date
    Aug 2008
    Location
    Sofia, Bulgaria
    Beans
    Hidden!
    Distro
    Xubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    So, when newly written and rewritten files became ext4 beneficial, this should mean if I `touch' all my downloads/ (for example), they will benefit the ext4 fs too?

    PS: Nice post, and thanks.. Just replaced Intrepid with Jaunty and I saw ext4 support. Awesome!

  8. #8
    Join Date
    May 2006
    Beans
    16
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    Thank you, worked perfectly!

    Boot times now blow Windows 7 RC out of the water!

  9. #9
    Join Date
    Jun 2007
    Location
    The Netherlands
    Beans
    1,278
    Distro
    Ubuntu Development Release

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    Quote Originally Posted by Onesimus View Post
    Is there away of doing this that doesn't rely on booting from the live CD ?

    (I have to install Ubuntu using the alternative CD because my computer spec doesn't meet the requirements to boot from live CD.)
    Well I have only tried it with a jaunty live-cd and a jaunty live-usb but technically you could use any lightweight boot that has the same version of the tools that are used in this how to, you don't need a window manager to do this.
    Maybe you could even do it from a second temporary jaunty install (although that might be a hassle)

  10. #10
    Join Date
    Jun 2007
    Location
    The Netherlands
    Beans
    1,278
    Distro
    Ubuntu Development Release

    Re: HOWTO: Convert your ext3 file system to ext4 (in Jaunty)

    Quote Originally Posted by Polizei View Post
    So, when newly written and rewritten files became ext4 beneficial, this should mean if I `touch' all my downloads/ (for example), they will benefit the ext4 fs too?

    PS: Nice post, and thanks.. Just replaced Intrepid with Jaunty and I saw ext4 support. Awesome!
    Well if I am not mistaken touch only changes the files time-stamp and doesn't rewrite the file completely. So if that is the case the only thing should be defragging (which is not available yet) or moving the files (and optionally moving them back to create an identical directory tree).

Page 1 of 5 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •