place to discuss Linux
Converting ext3 to ext4 Filesystem
Some time ago ext4 was released and available for Linux kernel. ext4 provides some additional benefits and perforce over ext3 file system. You can easily convert ext3 to ext4 file system. The next release of Fedora, 11, will default to the ext4 file system unless serious regressions are seen. In this quick tutorial you will learn about converting ext3 to ext4 file system.
ext4 Filesystem Features
The ext4 filesystem has more features and generally better performance than ext3, which is showing its age in the Linux filesystem world. Features include:
Delayed allocation & mballoc allocator for better on-disk allocation
- Sub-second timestamps
- Space preallocation
- Journal checksumming
- Large (>2T) file support
- Large (>16T) filesystem support
- Defragmentation support
WARNING! Once you run following commands, the filesystem will no longer be mountable using the ext3. Please note that ext4 may have some bugs so do not use for production servers (wait for sometime watch Linux kernel mailing list for ext4 bugs). It’s recommended that you keep /boot in a ext3 partition for sometime.
You need ext4 patch applied into kernel and compile kernel with ext4 support. Once done type the following command to convert an existing ext3 filesystem to use ext4, type:
# tune2fs -O extents,uninit_bg,dir_index /dev/dev-name
For example convert /dev/sdb1 to ext4, enter:
# cd /; umount /dev/sdb1
# tune2fs -O extents,uninit_bg,dir_index /dev/sdb1
Next run fsck, enter:
# fsck -pf /dev/sdb1
How do I mount ext4 partition?
mount -t ext4 /dev/sdb1 /path
mount -t ext4 /dev/sdb1 /share
mount -t ext4 /dev/disk/by-uuid/YOUR-PARTITION-UUID /share
How do I find out UUID for /dev/sdb1?
To probe filesystem type and read label and uuid for /dev/sdb1 (or any other device) use vol_id command:
$ sudo vol_id –uuid /dev/sdb1
Sample output:
41c22818-fbad-4da6-8196-c816df0b7aa8
How do I boot from ext4 (/boot)?
If you have converted /boot file system (or / used for /boot), update /boot/grub.conf (/boot/grub/menu.lst). Open file and find out current kernel config file and append the following:
rootfstype=ext4
Here is sample config (note I’ve custom kernel names):
title Ubuntu 8.10, kernel 2.6.28.1-vmware-guest-server
root (hd0,1)
kernel /boot/vmlinuz-2.6.28.1-vmware-guest-server root=UUID=8c2da865-13f4-47a2-9c92-2f31738469e8 ro quiet splash rootfstype=ext4
initrd /boot/initrd.img-2.6.28.1-vmware-guest-server
quiet
Save and close the file. And run update-grub:
$ sudo update-grub
Next, update your /etc/fstab file so that it can be mounted as ext4 file system:
UUID=41c22818-fbad-4da6-8196-c816df0b7aa8 /share ext4 defaults,errors=remount-ro,relatime 0 1
Finally, reboot the system:
$ sudo reboot
| Print article | This entry was posted by Ashik on April 7, 2009 at 3:15 pm, and is filed under Tutorials. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |


about 1 year ago
thanks dude nice post
can we apply this trick ubuntu 8.10
is there any other trick for ubuntu
awaiting your reply
about 1 year ago
On opensuse 11.1 : http://linuxpoison.blogspot.com/2009/01/ext4-support-on-opensuse-111.html