Linux Kernel formally supports the new file system EXT4 since 2.6.28. EXT4 is an improved version of EXT3 that modifies some of the important data structures in EXT3, not just as Ext3 to Ext2, but only adds a log function. EXT4 can provide better performance and reliability, as well as richer functionality:
1. Compatible with EXT3. by executing several commands, you can migrate from Ext3 online to EXT4 without reformatting the disk or reinstalling the system. The original EXT3 data structure is still retained, EXT4 action on new data, of course, the entire file system so that the EXT4 is supported by a larger capacity.
2. Larger file systems and larger files. EXT4 supports 1EB (1,048,576TB, 1EB=1024PB, 1PB=1024TB) file systems, as well as 16TB files, compared to the maximum 16TB file system and maximum 2TB files currently supported by EXT3.
3. An unlimited number of subdirectories. EXT3 currently supports only 32,000 subdirectories, while EXT4 supports an unlimited number of subdirectories.
4. Extents. EXT3 uses indirect block mapping, which is extremely inefficient when manipulating large files. For example, a 100MB size file, in the EXT3 to create 25,600 blocks (each block size of 4KB) mapping table. And EXT4 introduced the popular extents concept in modern file system, each extent is a set of successive blocks of data, the above file is expressed as "the file data is stored in the next 25,600 blocks", improve a lot of efficiency.
5. Multi-block distribution. when writing data to the Ext3 file system, EXT3 data block allocator can only allocate one 4KB block at a time, write a 100MB file will call 25,600 times the data block allocator, and EXT4 multiple distributor "Multiblock allocator" (MB ALLOC) supports the allocation of multiple blocks of data at one call.
6. Delayed distribution. EXT3 's block allocation strategy is allocated as quickly as possible, while the EXT4 and other modern file operating system strategies are to delay allocation as much as possible until the file is written in cache to begin allocating blocks of data and writing to disk, which optimizes the allocation of data blocks across the entire file. The combination of the first two features can significantly improve performance.
7. Fast fsck. previous fsck First step is slow because it checks all the inode, now EXT4 adds a list of unused inode to the Inode table for each group, so the fsck Ext4 file system can skip them and only check for the inode that is in use. Out.
8. Log check. logging is the most commonly used section and can easily lead to disk hardware failures, while recovering data from corrupted logs can result in more data corruption. The EXT4 log check feature makes it easy to determine whether log data is corrupted, and it merges the EXT3 two-stage logging mechanism into one phase, improving performance while increasing security.
9. "No Log"(no journaling) mode. The log has some overhead, and EXT4 allows logging to be turned off so that some users with special needs can improve performance.
10. Online defragmentation. Although deferred allocations, multiple-block allocations, and extents can effectively reduce file system fragmentation, fragmentation is inevitable. EXT4 supports online defragmentation and will provide e4defrag tools for defragmenting individual files or entire file systems.
One . Inode related characteristics. EXT4 supports larger inode sizes, which are 128 bytes larger than the default inode size of EXT3, EXT4 the default inode size is 256 bytes in order to accommodate more extended attributes (such as nanosecond timestamp or inode version) in the Inode. EXT4 also supports fast extended properties (fast extended attributes) and Inode retention (inodes reservation).
12. Persistent pre-distribution (persistent preallocation). Peer-to-peer software to ensure that the download file has enough space to store, often in advance to create an empty file with the same size as the downloaded file, so that in the next few hours or days of insufficient disk space cause download failure. EXT4 implements persistent prefetching at the file system level and provides the appropriate APIs (Posix_fallocate () in libc) that are more efficient than the application software itself.
13. Enable barrier by default. the disk is equipped with an internal cache to readjust the write order of bulk data and optimize write performance, so the file system must write a commit record after the log data has been written to disk, and if the commit record is written first and the log is potentially corrupted, data integrity is affected. EXT4 barrier is enabled by default, the data after barrier can be written only when all the data before barrier is written to disk. (This attribute can be disabled by the "mount-o barrier=0" command.) )