How to convert ext3 file system to ext4 without any data loss

Posted: February 4, 2016 in LINUX
Tags: , , ,

This tutorial is all about how to convert an ext3 file system in linux to an ext4 file system without having any loss in data.You can also say that this article is about file system upgradation in linux without any data loss. Whenever you need to upgrade your linux file system from ext3 to ext4 you can upgrade it very easily without losing your data.

Here in this article i have mentioned step wise method to convert an ext3 file system to ext4 file system without any loss in data.

Note:I am performing this Lab on RHEL6 Linux.

Step1:Create a partition /dev/sda5 using fdisk

#fdisk /dev/sda

 

Step2:Update the partition table using below command if you are using RHEL6

#partx -v -a /dev/sda

Note;if you are using RHEL5 use partprobe command to update the partition table.

 

Step3:Format the partition /dev/sda5 using ext3 file system

#mkfs.ext3 /dev/sda5

 

Step4:create a directory /new

#mkdir new

Step5: mount the newly created partition /dev/sda5 on /new using ext3 file system.

#mount -t ext3 /dev/sda5 /new

Step6: check the /dev/sda5 file sytem type and mount point

#df -Th

Step7: Now create some files on /dev/sda5

#cd /new

#touch {1..100}

#ls

you can see i have created few files inside /new which is mounted on /dev/sda5.

Now i am goint to convert this ext3 file system to ext4

1.first we need to unmount it.

#umount /dev/sda5

2.now convert it in to ext4 using tune2fs command

#tune2fs -O extents,uninit_bg,dir_index /dev/sda5
#fsck -pf /dev/sda5
#e2fsck -f /dev/sda5

 

3.now mount it on ext4 file system.

#mount -t ext4 /dev/sda5 /new

 

4.check whether it converted to ext4 or not using below command.

#df -Th

 

5.Now go to /new folder and check whether files created earlier are safe or not.

#cd /new

#ls

You will find that even after file system upgraded to ext4 from ext3 your data is safe. so no data loss at all.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s