Comparison of ext4 and ext3 under Linux

  

Linux kernel The new file system Ext4 has been officially supported since 2.6.28. Ext4 is an improved version of Ext3 that modifies some of the important data structures in Ext3, not just Ext3 vs. Ext2, but adds a logging feature. Ext4 provides better performance and reliability, as well as a richer set of features:

1. Compatible with Ext3. With a few commands, you can migrate from Ext3 online to Ext4 without having to reformat the disk or reinstall the system. The original Ext3 data structure remains as it is, and Ext4 acts on the new data. Of course, the entire file system thus gains the larger capacity supported by Ext4. 2. Larger file system and larger files. Compared to the maximum 16TB file system and maximum 2TB files currently supported by Ext3, Ext4 supports 1EB (1,048,576TB, 1EB=1024PB, 1PB=1024TB) file systems and 16TB files respectively. 3. An unlimited number of subdirectories. Ext3 currently only supports 32,000 subdirectories, while Ext4 supports an unlimited number of subdirectories.

4.Extents. Ext3 uses indirect block mapping, which is extremely inefficient when working with large files. For example, a file of 100MB size, in Ext3 to create a mapping table of 25,600 data blocks (each block size is 4KB). Ext4 introduces the popular concept of extents in modern file systems. Each extent is a set of consecutive data blocks. The above file is expressed as “the file data is stored in the next 25,600 data blocks”, which improves the Less efficient. 5. Multiple allocations. When writing data to the Ext3 file system, Ext3's data block allocator can only allocate one 4KB block at a time, write a 100MB file to call 25,600 data block allocators, and Ext4's multi-block allocator "ld4; Multiblockallocator (mballoc) supports multiple calls to allocate multiple data blocks. 6. Delayed allocation. Ext3's data block allocation strategy is to allocate as soon as possible, and Ext4 and other modern file
operating system
strategy is to delay the allocation as much as possible, until the file is written in the cache before starting to allocate data blocks and write to disk. This optimizes the block allocation of the entire file, and the combination of the first two features can significantly improve performance. 7. Fast fsck. Previously, the first step in executing fsck would be slow, because it checks all inodes. Now Ext4 adds a list of unused inodes to each group's inode table. In the future, the fsckExt4 file system can skip them. Just check the inodes that are in use. 8. Log verification. Logging is the most common part and can easily lead to disk hardware failures, and recovering data from corrupted logs can result in more data corruption. Ext4's log check function makes it easy to determine if log data is corrupted, and it combines Ext3's two-stage logging mechanism into one phase, improving performance while increasing security. 9. “No Journaling mode. There is always some overhead in logging, and Ext4 allows logging to be turned off so that some users with special needs can improve performance. 10. Online defragmentation. Although delay allocation, multi-block allocation, and extents can effectively reduce file system fragmentation, fragmentation is inevitable. Ext4 supports online defragmentation and will provide the e4defrag tool for defragmenting individual files or entire file systems. 11.inode related features. Ext4 supports larger inodes. Compared to Ext3's default inode size of 128 bytes, Ext4 has a default inode size of 256 bytes in order to accommodate more extended attributes (such as nanosecond timestamps or inode versions) in the inode. Ext4 also supports fastextended attributes and inode reservations. 12. Persistent preallocation. In order to ensure that the downloaded file has enough space to store, the P2P software often creates an empty file with the same size as the downloaded file in advance, so as to prevent the download failure from being insufficient due to insufficient disk space in the next few hours or days. Ext4 implements persistent pre-allocation at the file system level and provides the corresponding API (posix_fallocate() in libc), which is more efficient than the application itself. 13. The barrier is enabled by default. The disk is equipped with an internal cache to re-order the write operations of the batch data to optimize the write performance. Therefore, the file system must write the commit record after the log data is written to the disk. If the commit record is written first, the log may be Damage, then it will affect data integrity. Ext4 enables the barrier by default. The data after the barrier can be written only when all the data before the barrier is written to the disk. (This feature can be disabled by the "mount-o barrier=0″ command.)

Copyright © Windows knowledge All Rights Reserved