Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I believe the default OS file system in CentOS 5 is ext3.

Is it possible to use ext4 on Centos 5.x, or only on 6.x? Can I upgrade an existing ext3 filesystem to ext4?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

In addition to Kenny Rasschaert's answer:

You can find a nice explanation here:

http://www.debian-administration.org/article/Migrating_a_live_system_from_ext3_to_ext4_filesystem

Be warned that it can be dangerous and you should make a backup before attempting to do this.

Converting a root filesystem to ext4

Converting a root filesystem is a bit more tricky because you cannot unmount it, as your system is running on it. Nevertheless it is still possible to do it without using an external bootable media. You should do this in a single-user mode.

First step is to modify your /etc/fstab file to say "ext4" instead of "ext3" for root partition. This is important because you will be operating on a read-only filesystem later, and will not be able to make the change, and this would result in your system unable to mount a root filesystem on next boot.

Let us assume that root partition is /dev/sda1, so your /etc/fstab should look something like this.

/dev/sda1 / ext4 defaults 0 1

Now remount the root filesystem read-only.

mount -o remount,ro /

Then run a filesystem check on the root filesystem.

fsck.ext3 -pf /dev/sda1

It will tell you to reboot the system. That may be a good idea, so simply boot into single-user mode and remount it read-only again. It is fine even though we have already modified /etc/fstab, because ext3 can be mounted as ext4 without conversion.

Next, enable all the ext4 features on the root filesystem.

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

And run run a filesystem check on the root filesystem again. It will find and fix errors. This is normal.

fsck.ext4 -yfD /dev/sda1

You can now reboot to your new ext4 system, and enjoy faster filesystem check times, better performance, and all the improvements of ext4. Well, almost; read the next section.

share|improve this answer
    
I appreciate your fast respond. Thanks a lot!!! –  edotan Jul 21 '12 at 12:41
add comment

According to the Red Hat docs, ext4 is supported in version 5.6 and above.

Install the e4fsprogs package for ext4 utilities. In versions older than 5.6, these utilities may be found in the package ext4dev.

share|improve this answer
    
Thank you so much for your answer!! –  edotan Jul 21 '12 at 12:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.