Introduction to CentOS EXT4 File System

Source: Internet
Author: User

Linux kernel has officially supported the new file system Ext4 since 2.6.28. Ext4 is the ultimate version of Ext3. It modifies some important data structures in Ext3, not just like Ext3 for Ext2, but adds a log function. Ext4 provides better performance and reliability, as well as richer features:

1. compatible with Ext3. Execute several commands to migrate from Ext3 online to Ext4 without reformatting the disk or reinstalling the system. The original Ext3 data structure is retained, and Ext4 is used for new data. Of course, the entire file system also obtains a larger capacity supported by Ext4.

2. Larger file systems and larger files. Compared with the Ext3 currently supports a maximum of 16 TB file systems and a maximum of 2 TB files, Ext4 supports 1 EB (1,048,576 TB, 1 EB = 1024 Pb, 1 Pb = TB) file systems, and 16 TB files.

3. 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 ing. When operating large files, the efficiency is extremely low. For example, for a 100 MB file, a ing table of 25,600 data blocks (4 kb for each data block) must be created in Ext3. Ext4 introduces the popular extents concept in modern file systems. Each extent is a set of continuous data blocks, the preceding file indicates that the file data is stored in the next 25,600 data blocks, which improves the efficiency.

5. Multi-block allocation. When writing data to the Ext3 file system, the Ext3 data block distributor can allocate only one 4 kb block at a time. To write a 100 MB file, it is necessary to call the 25,600 data block distributor, the multiblock allocator (mballoc) Multi-block allocator of Ext4 supports allocating multiple data blocks at a time.

6. Delay allocation. The data block allocation policy of Ext3 is to allocate as soon as possible, while the policy of Ext4 and other modern file operating systems is to delay the allocation as much as possible, data blocks are allocated and written to the disk only after the files are written to the cache. This optimizes the data block allocation of the entire file and significantly improves the performance with the first two features.

7. Fast fsck. In the past, the first step of fsck execution was very slow, because it needs to check all inode. Now, Ext4 adds a list of inode not used in each group to the inode table, in the future, The fsck Ext4 file system can skip them and only check the inode in use.

8. Log verification. Logs are the most common part and can easily lead to disk hardware faults. Restoring data from damaged logs will cause more data corruption. The log verification function of Ext4 can easily determine whether the log data is damaged. It also combines the two-phase Log Mechanism of Ext3 into one phase, which improves the performance while increasing security.

9. No Journaling mode. The log has some overhead. Ext4 allows you to disable the log so that users with special requirements can improve the performance.

10. Online fragment. Although delayed allocation, multi-block allocation, and extents can effectively reduce File System fragments, fragments are inevitable. Ext4 supports online fragment and provides the e4defrag tool for fragment of individual files or the entire file system.

11. inode-related features. Ext4 supports a larger inode. Compared with the default inode size of 128 bytes in Ext3, Ext4 can accommodate more extended attributes (such as the nanosecond timestamp or inode version) in inode ), by default, the inode size is 256 bytes. Ext4 also supports fast extended attributes and inode reservation ).

12. Persistent preallocation ). In order to ensure sufficient storage space for the downloaded files, P2P software often creates an empty file with the same size as the downloaded file in advance, this prevents downloading failures 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 software itself.

13. barrier is enabled by default. The disk is equipped with an internal cache to re-adjust the write operation sequence of batch data and optimize the write performance. Therefore, the file system must write the log data to the disk before writing the commit record, if the commit record is written first, and the log may be damaged, data integrity will be affected. In Ext4, barrier is enabled by default. Only data before barrier is written to the disk can be written to data after barrier. (You can disable this feature by running the "mount-o barrier = 0" command .)


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.