Linux Guides & Reviews
RSS icon Home icon
  • Converting Ext3 to Ext4

    Posted on April 25th, 2009 admin No comments

    The new version of ubuntu brought the option of selecting the ext4 filesystem instead of ext3.  After reading some reviews, I chose to do this on mine, and noticed quite a speed increase (benchmarks: http://www.linuxinsight.com/first_benchmarks_of_the_ext4_file_system.html).

    After installing, my root partition was an ext4 partition, but my home partition was not since it was on a separate partition.  I decided to convert my home partition over to ext4 to get all of the benefits that it provides.

    WARNING: Do not do this to a root partition unless you know what you are doing.  I have not tested this/looked it up, and I do not know how this will end.  Also, as with all tweaks (especially on a filesystem), there is some danger of messing up your computer.  I am not responsible for anything that happens.  Make sure all of your files are backed up before attempting this.

    Converting

    Make sure your operating system supports ext4, and if not, apply any relevant patches to the kernel.

    Make sure you are using a live cd, or do not have the file system mounted.  Then, unmount the volume that you are converting, and convert it.

    Example with /dev/sda1 (run “fdisk -l” to see your filesystems):

    umount /dev/sda1
    tune2fs -O extents,uninit_bg,dir_index /dev/sda1

    Mounting

    Now that your filesystem is converted to ext4, you need to mount the drive.  To mount the drive to a directory for the current session (not automatically on reboot):

    mount -t ext4 /dev/sda /directory/to/mount/to

    To mount the drive permanently, you need to add it to your fstab:

    UUID=your-uuid-number-here /directory/to/mount/to ext4 relatime,errors=remount-ro 0 1

    Restart your computer.

    Booting from ext4 partition

    If you are booting from an ext4 partition (if your /boot directory is in your / directory, or if you are converting your /boot directory) you need to apply a few more tweaks before rebooting:

    sudo gedit /boot/grub/menu.lst

    Then, find your operating system and add the following to the end of the kernel line:

    rootfstype=ext4

    Now, update grub:

    sudo update-grub

    Update your fstab the same way you would have above:

    UUID=your-uuid-number-here /directory/to/mount/to ext4 relatime,errors=remount-ro 0 1

    Restart your computer.

    Leave a reply