This HOWTO is only preliminary draft, so no stable version right now. Also better let the author work on it untill this notice is removed, thanks. Use the discussion page for any comment.
Stable version to be found:
And other formats as well (may be) on the Stable HOWTOs page
If necessary use the Discussion page to give comments.
1. Discussion Page Content if any
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
5. HOWTO Content
7. Table Of Contents
- Before You Start
- Preparing the Kernel
- Getting the Kernel Sources
- Applying the Latest Ext4 Patchset
- Configuring, Compiling and Installing the Kernel
- Configuring GRUB
- Installing necessary utilities
- Getting the latest version of e2fsprogs
- Installing e2fsprogs
- Using the ext4 file system
- Creating a new ext4 partition
- Converting an existing ext3 partition to ext4
Ext4 is the next generation of ext2 and ext3 file systems, which dominate in the world of GNU/Linux systems. After more than two and a half years of development, ext4 is finally considered safe for use in production environments and the first stable version is inlcluded in Linux 2.6.28.
This document covers all the necessary steps to migrate from ext3 to the new ext4 file system, since no GNU/Linux distribution supports the new file system by default, yet.
9. Before you start
There are few things that you should keep in mind before you start. First of all, back up all your important data. A mistake during this operation may result in partial or complete data loss.
Currently, no stable version of grub can boot a kernel from an ext4 partition. So, make sure that your /boot directory, which contains the kernel (or kernels) and grub configuration files, is located on a different ext3 partition, which will not be converted to ext4 afterwards.
Last but not least, you'll need development tools such as the GNU Compiler Collection, to compile the kernel and install utilities that are necessary for the procedure of migration to the new file system.
10. Preparing the kernel
10.1. Getting the kernel sources
First of all, we need to get the latest stable version of Linux, which has support for ext4. At the time I write this lines, this version is 220.127.116.11.
Go to [[|The Official Kernel Archives]] and download the full source of the latest stable kernel. This may take a while, depending on your line -the kernel source is approximatelly 50MB.
After you download the kernel sources, extract them to /usr/src/ directory. Don't forget to link /usr/src/linux to /usr/src/linux-VERSION.
gatoni@gentooBox ~ $ tar -xvjf linux-18.104.22.168.tar.bz2 -C /usr/src/<<BR>> gatoni@gentooBox ~ $ ln -s /usr/src/linux-22.214.171.124 /usr/src/linux<<BR>>
10.2. Applying the latest ext4 patchset
As stated on official ext4 wiki, it's highly recommended to apply the latest [[|ext4 patchset]] to the kernel source.
Once you download the patchset, move it to the source directory, extract it and apply it to the kernel source using the patch program.
gatoni@gentooBox /usr/src/linux $ bunzip2 2.6.28-ext4-4.bz2<<BR>> gatoni@gentooBox /usr/src/linux $ patch -p1 < 2.6.28-ext4-4<<BR>>
10.3. Configuring, compiling and installing the kernel
Before compiling the kernel, we should configure it. I suppose you're familiar with the the procedure of configuring a Linux kernel. In case you're not, a good starting point is the README file which is located in the kernel source's directory.
Use make menuconfig to start the interactive kernel configuration utility.
gatoni@gentooBox /usr/src/linux $ make menuconfig
To enhance your kernel with support for ext4 filesystem, you should enter the file systems menu, and select The Extended 4 (ext4) file system to be built-in. Do not forget to select The Extended 3 file system support to be built-in to your kernel, since you will not be able to access your /boot directory or any other ext3 file systems you might have and wish to keep!
After you finish configuring the kernel, you must compile it. Don't forget to do make modules_install in case you configured any parts of kernel as modules.
gatoni@gentooBox /usr/src/linux $ make
The compilation may take quite a while depending on your hardware. After it's done, you must copy the new kernel image to your /boot partition. It's highly recommended to keep your old kernel, in case something goes wrong. So make sure you don't overwrite your existing kernel.
gatoni@gentooBox /usr/src/linux $ cp arch/x86/boot/bzImage /boot/linux-126.96.36.199_ext4
10.4. Configuring GRUB
To be able to boot our new kernel, we must configure our boot loader, first. I'll describe the procedure of configuration of GRUB boot loader, since most mainstream GNU/Linux distributions use it as default.
We'll append another boot entry to the GRUB configuration file, without modifying the ones that exist, so you can always boot your stable and working kernel, in case the new one has any issues.
Open /boot/groub/grub.conf with your favourite editor. Now, you'll need to add a boot entry which has the following form:
title ''title in boot menu''<<BR>> root ''device''<<BR>> kernel path/to/kernel root=root device<<BR>>
For example, an entry might look like this:
title Gentoo ( Linux 188.8.131.52, Ext4 Support )<<BR>> root (hd0,0)<<BR>> kernel /boot/linux-184.108.40.206_ext4 root=/dev/sda3<<BR>>
For more information, refer to [[|GRUB manual]].
After adding a boot entry for our new ext4-enhanced kernel, save your changes and quit.