Edit this section ext4 (the fourth extended File System)

Source: Internet
Author: User

I checked Android's operations on file attributes and found that it uses the ext4 file system. The introduction to the ext4 file system is as follows.

 

Ext4 is an ext3 extended log file system. It is the fourth version of the original extended File System (EXT or extfs) specially developed for Linux. Linux Kernel has officially supported the new file system ext4 since 2.6.28. Ext4 is
The ultimate version of ext3 modifies some important data structures in ext3, not just like ext3 for ext2, but just adds a log function. Ext4 provides better performance and reliability, as well as richer features.

Compared with ext3, ext3 has the following 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.