Ext4 Fast FSCK Ted Tso
Ext4 Fast FSCK Ted Tso
in ext4
Theodore Ts'o
Why File System Checks Are Necessary
0 1000 200
On-disk Extents Format
struct ext4_extent {
__le32 ee_block; /* first logical block extent covers */
__le16 ee_len; /* number of blocks covered by extent */
__le16 ee_start_hi; /* high 16 bits of physical block */
__le32 ee_start; /* low 32 bits of physical block */
};
Ext4 Extent Map
disk blocks
i_data 200
201
header ...
0 ...
1199
1000 ...
200 ...
6000
1001
6001
2000 ...
6000 6199
...
...
...
...
Extents Tree
header 0
0
root ...
... ...
extents
extents index ...
node header
Test image for doing e2fsck comparisons
Ext3 filesystem
Number of inodes with indirect blocks: 40,860
Number of inodes with double indirect blocks: 394
Amount of indirect block metadata: 199MB
Difference in pass 1 times between e2fsck of an empty and populated file
system: 170.56 seconds
21.74 seconds, 51.76 Mb/s vs. 192.30 seconds, 6.89 Mb/s
Ext4 filesystem
Number of inodes with a depth > 1 extent tree: 60
Difference in pass 1 times between e2fsck of an empty and populated file
system: 9.80 seconds
0.07 seconds, 56.57 Mb/s vs 9.87 seconds, 20.56 MB/s
Skipping unused inodes in the inode table
Improvements from
Fewer extent tree blocks to read instead of indirect blocks
Uninitialized block groups means we don't have to read portions of the inode
table
Directory blocks are allocated so they are grouped together to speed up
pass #2
e2fsckonext3 e2fsckonext4
time MBread time MBread
Pass1 192.3 1324 9.87 203
Pass2 11.81 260 6.34 261
Pass3 0.01 1 0.01 1
Pass4 0.13 0 0.18 0
Pass5 6.56 3 2.24 2
Total 211.1 1588 18.75 466
Summary of ext4 improvements
Better Performance
Extents help performance for large files
Better block and inode allocation
More efficient journal commits
File preallocation
Increased protection for data integrity
Barriers on by default
Metadata checksums
New file system features
Fine grained time stamps
Better support for NFSv4
Better file system scalability
File system sizes up to 1 exabyte
> 32000 sub directories
Faster file system checks
How to use ext4
This work represents the view of the author(s) and does not
necessarily represent the view of IBM or of the Linux
Foundation.
IBM is a registered trademark of International Business
Machines Corporation in the United States and/or other
countries.
Linux is a registered trademark of Linus Torvalds.
Microsoft and Windows are trademarks of Microsoft
Corporation in the United States, other countries, or both.
Other company, product, and service names may be
trademarks or service marks of others.