Jump to Navigation

262 - ext4

To use ext4 file system, you need to have RedHat v5.3 or later, It means boot into 2.6.18-128.el5 or higher, and need a package.

# yum install e4fsprogs

The e4fsprogs package is designed to install alongside stock e2fsprogs without overlapping, so some utilities are renamed;
for example e4fsck, debuge4fs, e4image,   etc. rpm -q e4fsprogs | grep bin will give a good summary of what is included.

1. Initial install OS(RedHat v5 or CentOS v5)

People who want ext4 from the installer should pass "ext4" as a boot option.
This may still be considered experimental.
When you install the OS(RedHat or Centos), you can enter the following command in the boot option.
So you will configure the mount point as ext4. (select ext4 from the drop down list on the file system).

boot: linux ext4 vesa

2. To convert the current mount point to ext4 from ext3

# yum info e4fsprogs
# yum install e4fsprogs

# umount /d01  (/dev/VolGroup00/LogVol02)

* Convert it to ext4

# tune4fs -O extents,uninit_bg,dir_index /dev/VolGroup00/LogVol02

# e4fsck -fDC0 /dev/VolGroup00/LogVol02

* Mount the ext4 space

# mount -t ext4 -o nobarrier /dev/VolGroup00/LogVol02 /d01


# vi /etc/fstab

/dev/VolGroup00/LogVol02 /d01                    ext4    nobarrier       1 2

# reboot

3. To convert / (root dir) to ext4

* Getting a backup and convert

# dd if=/dev/VolGroup00/LogVol00 of=/backup/VolGroup00-LogVol00.bak

# tune4fs -O extents,uninit_bg,dir_index /dev/VolGroup00/LogVol00

# init 1    ( <--- Single mode )

# e4fsck -fDC0 -y /dev/VolGroup00/LogVol00

* Edit /etc/fstab

# vi /etc/fstab

/dev/VolGroup00/LogVol00 /                    ext4    nobarrier       1 1

Continue to #4.

4. Rebuild the kernel image for ext4

* Getting a backup

# mv /boot/initrd-`uname -r`.img /boot/initrd-`uname -r`.img.old

* Rebuild the kernel image

# mkinitrd -v --with=ext4 /boot/initrd-`uname -r`.img `uname -r`


# mkinitrd -v -f initrd-2.6.18-308.16.1.el5.img 2.6.18-308.16.1.el5

5. Change the run level

# e4fsck -fDC0 /dev/VolGroup00/LogVol00

# init 6

6. if the reboot problem, need the DVD to fix

Reboot from DVD with linux rescue

# fsck -t ext4 -f /dev/mapper/VolGroup00-LogVolRoot

# mount | grep ext4

7. Increase performance

If you need to improve more I/O performance on ext4, You can use the following options :

 nobarrier, noatime, nodiratime, data=writeback, nobh

* To usr data=writeback on / (root dir)

# tune4fs -o journal_data_writeback /dev/VolGroup00/LogVol02

# e4fsck -fDC0 /dev/VolGroup00/LogVol02

# vi /boot/grub/menu.lst
title CentOS (2.6.9-55.ELsmp)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-55.ELsmp ro root=/dev/md2 rhgb quiet rootflags=data=writeback
        initrd /initrd-2.6.9-55.ELsmp.img





Main menu 2

Story | by Dr. Radut