Wednesday, July 2, 2014

How to convert an EXT3 filesystem partition to EXT4

Ext4 fiflesystem includes multiple improvements in terms of filesystem performance. It this article we show how to convert an ext3 fileystem to ext4 and thus enabling some of the ext4 performance enhancement features.

Before you continue, please note that after you convert your ext3 partition to ext4 filesystem you will no longer be able to mount that partition as ext3. Furthermore, if the ext3 partition you are going to convert to ext4 is used by Grub during boot load process, make sure that Grub loader is capable boot using ext4 filesystem.

In our example scenario we will use existing /dev/sdb1 partition formatted with ext3 filesystem. Here is our ext3 mounted partition:

# mount | grep sdb1
/dev/sdb1 on /mnt/temp type ext3 (rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered)

Make sure to unmount your ext3 partition before continue:

# umount  /mnt/temp/

Modify ext3 filesystem to include ext4 features:
# tune2fs -O extents,uninit_bg,dir_index /dev/sdb1 
tune2fs 1.42.5 (29-Jul-2012)

Optimize/repair filesystem directories filesystem and force a filesystem check:

# e2fsck -fD /dev/sdb1
e2fsck 1.42.5 (29-Jul-2012)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure                                           
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdb1: 12/54216 files (0.0% non-contiguous), 12765/216060 blocks

Now we can test mount our new ext4 filesytem:

# mount /dev/sdb1 /mnt/temp/
# mount | grep sdb1
/dev/sdb1 on /mnt/temp type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)

All done. We have successfully converted ext3 filesystem to ext4.


No comments :

Post a Comment