May 21, 2022
1 Convert the filesystem to ext4
Run the following command to convert from ext2 to ext4:
tune2fs -O extents,uninit_bg,dir_index,has_journal /dev/sda1
For converting from ext3 to ext4, run the command:
tune2fs -O extents,uninit_bg,dir_index /dev/sda1
2. Check the filesystem for errors
e2fsck -pf /dev/sda1
3. Mount the filesystem
mount -t ext4 /dev/sda1 /mnt
You can check /mnt directory to ensure that the previous data is present there unaffected.
4. Update the filesystem type in fstab file
Open the /etc/fstab file of your original system. If you mounted it to /mnt, then the path is /mnt/etc/fstab.
vi /mnt/etc/fstab
Search for previous file system reference (ext2 or ext3) and edit it to ext4. Save the changes made to the file and exit.
5. Update grub
update grub
6. Reboot
Once all done, unmount /dev/sda and reboot the system.
cd /tmp
umount /mnt
shutdown -r now