Watch all our Tutorials and Training Videos for Free on our Youtube Channel, Get Online Web Tools for Free on swebtools.com

Search Suggest

Convert ext4 or ext3 or ext2 in Linux without losing data


Convert ext4 or ext3 or ext2 in Linux without losing data

This post will help you with how to convert ext4 or ext3 or ext2 in Linux without losing data.

If you are interested in learning, Request you to go through the below recommended tutorial.




How to Convert ext4 or ext3 or ext2 in Linux without losing data?


This article shows you how to convert one filesystem to another filesystems in linux without losing the data. By default, Linux will have anyone of these filesystems Ext2, ext3, ext4 and xfs. It doesnt matter the disk partition is a standard partition or LVM Partition.

We will discuss the below scenarios.

1. How to convert ext2 filesystem to ext3 filesystem in Linux
2. How to convert ext3 filesystem to ext2 filesystem in Linux.
3. How to convert ext2/ext3 filesystem to ext4 filesystem in Linux

For example, Lets see how to convert the below disk partition /dev/sdb1 which is mounted on /mnt1 with ext2 filesystem and this volume has some data. It doesnt matter the disk partition is a standard partition (/dev/sdb1) or LVM (/dev/volgroup01/lvol01).

If you are going to do this conversion on LVM, just replace the /dev/sdb1 with your logical volume. Always take a backup before doing this kind of activities which is recommended.
[root@server ~]# df -h /mnt1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       248M  199M   38M  85% /mnt1
[root@server ~]# mount | grep -i /mnt1
/dev/sdb1 on /mnt1 type ext2 (rw,relatime,seclabel,stripe=8192)

1. How to convert ext2 filesystem to ext3 filesystem in Linux without losing the Data.


Unmount the disk from the mount point.
[root@server ~]# umount /dev/sdb1

To convert ext2 to ext3 filesystem, Use tune2fs command along with "-j" option which enables the journaling.
[root@server ~]# tune2fs -j /dev/sdb1
tune2fs 1.42.9 (28-Dec-2013)
Creating journal inode: done

Mount the partition using mount command.
[root@server ~]# mount /dev/sdb1 /mnt1

Check the filesystem type of the mountpoint.
[root@server ~]# mount | grep /mnt1
/dev/sdb1 on /mnt1 type ext3 (rw,relatime,seclabel,stripe=8192,data=ordered)

Filesystem type got changed from ext2 to ext3 as expected.

2. How to convert ext3 to ext2 filesystem in Linux without losing the data.


Unmount the disk from the mount point.
[root@server ~]# umount /dev/sdb1

To convert ext3 to ext2 filesystem, Use tune2fs command along with "-O ^has_journal" option to disable the journaling features.
[root@server ~]# tune2fs -O ^has_journal /dev/sdb1
tune2fs 1.42.9 (28-Dec-2013)
Creating journal inode: done

Mount the partition using mount command.
[root@server ~]# mount /dev/sdb1 /mnt1

Check the filesystem type of the mountpoint.
[root@server ~]# mount | grep /mnt1
/dev/sdb1 on /mnt1 type ext2 (rw,relatime,seclabel,stripe=8192)

Filesystem type got changed from ext3 to ext2 as expected.

3. How to convert ext2/ext3 filesystem to ext4 filesystem in Linux without losing the Data.


Unmount the disk from the mount point.
[root@server ~]# umount /dev/sdb1

To convert ext2/ext3 to ext4 filesystem, Use tune2fs command along with "-O extents,uninit_bg,dir_index" option enable the journaling features.
[root@server ~]# tune2fs -O extents,uninit_bg,dir_index /dev/sdb1
tune2fs 1.42.9 (28-Dec-2013)
Creating journal inode: done

Mount the partition using mount command.
[root@server ~]# mount /dev/sdb1 /mnt1

Check the filesystem type of the mountpoint.
[root@server ~]# mount | grep /mnt1
/dev/sdb1 on /mnt1 type ext4 (rw,relatime,seclabel,stripe=8192)

Filesystem type got changed from ext2/ext3 to ext4 as expected. Your data will be remain same.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

convert ext4 filesystem in Linux, How to convert ext2 to ext3, How to convert ext2 to ext4, linux, ext3 to ext4 convert, ext3 to ext4 conversion