Linux file system ext4 ext3

What is Ext2, Ext3 & Ext4 and How to Create and Convert Linux File Systems

I have used my Fedora old system to test where I converted from ext2 to ext3, ext2 to ext4, and ext3 to ext4 file systems successfully.

By following this guide anyone can convert their file systems smartly, but still, I like to WARN you all before doing this because the following task required skilled administrative practices, and make sure you must take the important backup of your files before doing this. If in case something goes wrong at least you can revert to back with your backup data.

In a computer, a file system is a way in which files are named and placed logically to store, retrieve, and update the data and also used to manage space on the available devices.

The file system is divided into two segments called User Data and Metadata. In this article, I am trying to explore how to create and convert various Linux file systems and high-level differences amongst Ext2, Ext3, and Ext4 file systems.

Читайте также:  Обмен сообщениями между процессами linux

Before moving further readings, let me introduce a brief about Linux file systems.

Ext2 – Second Extended File System

  1. The ext2 file system was introduced in 1993 and Ext2 was developed by Remy Card. It was the first default file system in several Linux distros like RedHat and Debian.
  2. It was to overcome the limitation of the legacy Ext file system.
  3. Maximum file size is 16GB – 2TB.
  4. The journaling feature is not available.
  5. It’s being used for normally Flash-based storage media like USB Flash drive, SD Card, etc.

Ext3 – Third Extended File System

  1. Ext3 file system was introduced in 2001 and the same was integrated with Kernel 2.4.15 with a journaling feature, which is to improve reliability and eliminates the need to check the file system after an unclean shutdown.
  2. Max file size 16GB – 2TB.
  3. Provide facility to upgrade from Ext2 to Ext3 file systems without having to back up and restore data.

Ext4 – Fourth Extended File System

  1. Ext4, the high-anticipated Ext3 successor.
  2. In October 2008, Ext4 as stable code was merged in Kernel 2.6.28 which contains an Ext4 file system.
  3. Backward compatibility.
  4. Max file size 16GB to 16TB.
  5. The ext4 file system has the option to Turn Off the journaling feature.
  6. Other features like Sub Directory Scalability, Multiblock Allocation, Delayed Allocation, Fast FSCK etc.

How to Determine File System Type?

To determine your Linux file system type, run the following command in the terminal as a root user.

# df -hT | awk '' | grep "^/dev" /dev/sda3 ext3 / /dev/sda1 ext3 /boot

Creating an Ext2, or Ext3, or Ext4 File Systems

Once you create a file system using fdisk or parted command, use mke2fs command to create either of the file system and make sure you replace hdXX with your device name.

Читайте также:  Osint framework kali linux

Creating a Ext2 File System

Creating a Ext3 File System

# mke2fs –j /dev/hdXX OR # mkfs.ext3 /dev/hdXX

-j option is used for journaling.

Creating the Ext4 File System

# mke2fs -t ext4 /dev/hdXX OR # mkfs.ext4 /dev/hdXX

-t option to specify the file system type.

Converting an Ext2, or Ext3, or Ext4 File Systems

It is always a better way to unmount the file systems and convert them. Conversion can be done without unmounting and mounting the filesystem. Again replace hdXX with your device name.

Converting Ext2 to Ext3

To change an ext2 file system to ext3 enabling the journal feature, use the command.

Converting Ext2 to Ext4

To convert from old ext2 to new ext4 file system with the latest journaling feature. Run the following command.

# tune2fs -O dir_index,has_journal,uninit_bg /dev/hdXX

Next, do a complete file system check with the e2fsck command to fix and repair.

-p option automatically repairs the file system.
-f option forces checking file system even it seems clean.

Converting Ext3 to Ext4

To enable the ext4 features on an existing ext3 filesystem, use the command.

# tune2fs -O extents,uninit_bg,dir_index /dev/hdXX

WARNING: You cannot revert or mount back to the ext3 filesystem once you run the above command.

After running this command we MUST run fsck to fix up some on-disk structures that tune2fs have modified.

WARNING: Please try all these above commands on your testing Linux server.

Источник

Оцените статью
Adblock
detector