The Fourth Extended filesystem (Ext4) is Linux’s native file system made to overcome the problems with Ext3. The file system was first released as extensions to Ext3, which were backward-compatible. Later on, for stability reasons, the producer decided that the source code be forked, and all the developments were done there. Google additionally decided to use Ext4 on Android 2.3. Throughout this article, you will read about Ext4’s compatibility, history, features, and a side-by-side comparison with other Linux file systems.
Part 1. Ext4 File System Compatibility
The Ext4 file system became the default file system for many popular Linux distributors, such as Ubuntu and Debian. The filesystem is officially incompatible with Windows and macOS, but there are ways around this limitation.
Windows users have multiple choices. They can use third-party apps, use WSL 2, or convert it to NTFS. Check out the steps in the article how to mount Ext4 on Windows.
As Mac users, they can use tools such as macFUSE, virtual machine hosts, or third-party apps that grant access to this file system. Here is the tutorial on mounting and accessing Ext4 files on macOS.
Part 2. History of EXT File System
Minix was initially created in 1987 by Andrew S. Tanenbaum as an educational tool for his book Operating Systems Design and Implementation. Today, it is a text-oriented OS with a kernel of fewer than 6,000 lines of code. MINIX's most prominent claim to fame is an example of a microkernel, in which each device driver runs as an isolated user-mode process. This structure increases security and reliability because a bug in a driver cannot bring down the entire system.
Nowadays, MINIX is commonly known as a footnote in the history of GNU/Linux. This file system motivated Linus Torvalds to develop Linux, and some of his earlier work was written on MINIX. Torvalds's earlier decision to support the MINIX file system is responsible for the Linux kernel's support of almost every filesystem imaginable.
The earliest EXT file system (Extended) was composed by Rémy Card and released with the Linux operating system in 1992 to overpower the size limitations of the Minix file system. The immediate structural modifications were to the filesystem's metadata, which was based on the Unix filesystem (UFS), also known as the Berkeley Fast File System (FFS).
There is limited information on this file system because it had significant problems and was quickly superseded by the EXT2 file system.
The Ext2 file system was quite successful at first. Customers used Ext2 in Linux distributions for multiple years and were happy with it. The EXT2 file system essentially has the exact same metadata structures as the EXT file system. However, EXT2 is more straightforward when considering the amount of disk space that is left between the metadata structures for forthcoming use.
Similar to Minix, EXT2 contains a boot sector in the first sector of the hard drive on which it is installed, which has a minimal boot record and a partition table. Furthermore, you will see a certain amount of reserved disk space after the boot sector is done. This reserved space spans the space between your boot record and the first HDD partition that is often on the next cylinder boundary.
The EXT3 file system had the express objective of overcoming the enormous portions of time that the fsck program needed to fully recover a disk structure sabotaged by an improper shutdown that happened during an update operation being done to your files. The singular addition to the EXT file system was the journal feature, which records the changes that will be done to the filesystem in advance.
The journaling feature decreases the time needed to check the hard drive for inconsistencies after a failure from days to mere minutes, at the most. There have been many issues reported over the years that crashed users' systems. The details could take up an entire article, but suffice it to say that a lot of them were self-inflicted and were not system failures. The EXT filesystem's journaling feature has decreased that bootup recovery time.
In EXT4, the producer changed data allocation from fixed blocks to extents. Its starting and ending place on the hard drive describes an extent. This feature makes it possible to describe long, physically adjacent files in a single iNode pointer entry, which can greatly decrease the number of pointers needed to define the location of all the data in larger files. EXT4 downsizes fragmentation by spreading newly created files across the disk so that they are not clustered in one location in the disk, as numerous early PC filesystems did.
The file-allocation algorithms try to spread the files as evenly as possible between the cylinder groups and, when fragmentation is required, to keep the discontinuous file extents as tight as possible to others so as to minimize head seek and rotational latency by a lot.
In case you need to recover data from your Ext2-Ext4 partitions, you can use Wondershare Recoverit.
Recoverit can find data from emptied Mac trash, data lost from a bad sector, corruption of the hard drive, and accidental permanent deletion.
The software is incredibly easy to use and even has a preview function, so you can double check that you are restoring the proper file.
Support recovering 1000+ types of file formats: DOC/DOCX, XLS/XLSX, PDF, JPG, HEIF, HTML, INDD, EPS, MP4, MP3, zip, etc.
Part 3. Features of Ext4
- File system size: Ext4 allows filesystems up to 1 exbibyte size and files up to 16 tebibytes size. The ext3 file system endows only a maximum filesystem size of 16 TB and maximum file size of 2 TB.
- Extents: The idea extent means “a bordering sequence of physical blocks.” Large files are divided into several “extents.” The files are then allocated to a ‘single extent’ rather than a particular size, thus bypassing the indirect mapping of blocks. Each iNode stores up to 4 extents of a file and indexes the rest in an Htree. Therefore, extents allow less fragmentation which is due to a sequential block allocation and improve performance.
- Delayed & Multiblock allocation: multiblock allocation (mballoc) allocates multiple blocks for a file in a single operation instead of allocating them one by one, as in ext3. This feature will reduce the overhead of calling the “block allocator” several times and optimize memory allocation. In the delayed allocation feature, if a function writes data onto a disk rather than allocating it at once, the data will get stored in the cache. Delayed allocation will only write all data in the cache after “flush” -ing the cache. This technique is called “allocate-on-flush.”
- Online defragmentation & fsck speed: The fragmentation rate is lesser in ext4 systems due to the techniques that we mentioned above. However, that does not mean 0% fragmentation. Defragmentation, when needed, can be done online using the tool “e4defrag”.
- Journal checksumming: Ext4 uses the checksum of the journal to find out the health of the journal blocks. This feature is used to evade data corruption. You can turn off the journaling mode in ext4 if it causes overhead.
- Inodes/Timestamps: The ext4 file system has a large inode size of 256 bytes by default, whereas ext3 has only 128 bytes for inodes. The time stamp accuracy is stored in nanoseconds instead of seconds in the case of ext3.
- Backward compatibility: Ext3 file systems can be migrated to ext4 easily without formatting or reinstalling the OS, provided the kernel supports the ext4 file system.
More Related: How To Undelete Files on EXT4 File System
Part 4. Advantages and Disadvantages of Ext4
You can utilize different disks/LUNs and have more satisfactory performance. Doing so can increase the performance of the databases as you can have the transaction log on one storage and the data files on another. Comparable to disk I/O intensive web-based applications
You can use various mount options that increase the protection or influence the performance or stability more granularly
You manage the space separately. So, you can have a malicious application that fills the space that is not affecting other applications
Fragmentation of a specific partition is separate from the other
You can unassisted snapshot, mount, umount, format, defragment, and monitor the performance of file systems
You can have encryption on specific volumes
You can mount volumes on demand
The filesystem raises the administration overhead
You will have more cases of having wasted more disk space than needed
You will have more incidents involving your disk being full
It is more challenging to create a consistent snapshot of an application running on different volumes
It uses slightly more resources
Depending on the volume type (MS-DOS label, LVM, btrfs...), you might be unable to efficiently allocate space from one volume by shrinking another volume
Part 5. Working With Ext4
- Creating Files on Ext4 File System
To create files on Ext4, you need to format the partition with the Ext4 file system using the mkfs.ext4 command:
~]# mke4fs -t ext4 blockdevice
In this command line, block device is a partition that is going to contain the ext4 file system you will be creating.
Labeling the partition using the e4label command:
~]# e4label <block_device> new-label
Creating a mount point and mounting the new file system to that mount point:
~]# mkdir /mount/point
~]# mount block_device /mount/point
- Mounting Ext4 File System and Setting Parameters
Users have two ways to mount Ext4 file systems: using default options and setting parameters. The command line for using default settings is as follows:
~]# mount block_device /mount/point
To set parameters for your file, use the tune2fs command. Some parameters you can set with this command are as follows:
Setting volume label: use -L option alongside tune2fs similar to this command line: sudo tune2fs -L Label_Name /dev/sda2
Listing file system parameters: once again, use the -L option with tune2fs identical to the following command line: sudo tune2fs -l /dev/sda2
- Resizing Ext4 File System
Users must ensure that the underlying block device has enough size for the Ext4 file system that the command line will resize. Use the resize4fs command to change the size of your files:
~]# resize4fs block_devicenew_size
- Defragmentation of Ext4 File System
Some Ext4 files are made with the extent option, which means you can use e4defrag to do the defragmentation. To check for fragmentation levels, use this command line:
sudo e4defrag -c /path/to/myfiles
In some cases, the fragmentation score is zero, meaning defragmentation is not necessary. However, if you want to do it, use the following command line:
Part 6. Ext4 vs Other Linux File Systems
Linux supports various file systems such as Ext4, XFS, Btfrs, ZFS, JFS, and NTFS. Each type of file system solves different problems and has its limitations.
Linux File Systems
|Ext4||December 2008||Mingming Cao, Andreas Dilger, Alex Zhuravlev (Tomas), Dave Kleikamp, Theodore Ts'o, Eric Sandeen, Sam Naghshineh||Using it for applications that use a single read or write thread||Does not have secure deletion feature|
|XFS||May 2000||Silicon Graphics, Red Hat||Best when used for big computing systems and systems that require high performance||Slower metadata operations|
|Btrfs||March 2009||Facebook, Fujitsu, Fusion-IO, Intel, Linux Foundation, Netgear, Oracle Corporation, Red Hat, STRATO AG, and openSUSE||Best when used to counteract obstacles like fault tolerance, management, and data protection||High level of data fragmentation|
|ZFS||June 2006||Sun Microsystems||creating a file system that spans across a series of drives or a pool||Failure to check RAM health in the case of data errors|
|JFS||June 2001||IBM et al.||Keeping the metadata consistent when journaling it||Not being able to shrink a JFS partition|
|NTFS||1993||Microsoft||Preventing data loss in the case of power loss||Compatibility issues with android and macOS|
You can learn which Linux file system should you use for your computer in the video guide below:
People Also Ask
Is Ext4 better than NTFS?
Various benchmarks have concluded that the ext4 file system can perform multiple read-write operations faster than an NTFS partition. Note that while these tests do not indicate real-world performance, we can extrapolate these results and use this as one reason.
Is Ext4 a Windows file system?
The Ext4 file system format is native to Linux, and the Windows operating system does not support it by default, but there are ways around it.
Why can Windows not read Ext4?
The main reason for Windows’ inability to read Ext4 is that it’s not made with drivers made for that file system.
Is Ext4 faster than FAT32?
There are multiple benchmarks on the internet stating that the Ext4 file system format is much faster than FAT32 (and even NTFS).