Fast ext4 fsck times
This wasn’t one of the things we were explicitly engineering for when were designing the features that would go into ext4, but one of the things which we’ve found as a pleasant surprise is how much more quickly ext4 filesystems can be checked. Ric Wheeler reported some really good fsck times that were over ten times better than ext3 using filesystems generated using what was admittedly a very artificial/synthetic benchmark. During the past six weeks, though, I’ve been using ext4 on my laptop, and I’ve seen very similar results.
This past week, while at LinuxWorld, I’ve been wowing people with the following demonstration. Using an LVM snapshot, I ran e2fsck on the root filesystem on my laptop. So using a 128 gigabyte filesystem, on a laptop drive, this is what people who got to see my demo saw:
e2fsck 1.41.0 (10-Jul-2008) Pass 1: Checking inodes, blocks, and sizes Pass 1: Memory used: 3440k/12060k (3311k/130k), time: 17.82/ 5.52/ 1.11 Pass 1: I/O read: 233MB, write: 0MB, rate: 13.08MB/s Pass 2: Checking directory structure Pass 2: Memory used: 3440k/13476k (3311k/130k), time: 41.47/ 2.16/ 3.30 Pass 2: I/O read: 274MB, write: 0MB, rate: 6.61MB/s Pass 3: Checking directory connectivity Peak memory: Memory used: 3440k/14504k (3311k/130k), time: 59.88/ 7.75/ 4.42 Pass 3: Memory used: 3440k/13476k (3311k/130k), time: 0.04/ 0.02/ 0.01 Pass 3: I/O read: 1MB, write: 0MB, rate: 27.38MB/s Pass 4: Checking reference counts Pass 4: Memory used: 3440k/6848k (3310k/131k), time: 0.25/ 0.24/ 0.00 Pass 4: I/O read: 0MB, write: 0MB, rate: 0.00MB/s Pass 5: Checking group summary information Pass 5: Memory used: 3440k/5820k (3310k/131k), time: 3.13/ 1.85/ 0.10 Pass 5: I/O read: 5MB, write: 0MB, rate: 1.60MB/s 779726 inodes used (9.30%) 1 non-contiguous inode (0.0%) # of inodes with ind/dind/tind blocks: 719/712/712 22706429 blocks used (67.67%) 0 bad blocks 4 large files 673584 regular files 58903 directories 1304 character device files 4575 block device files 11 fifos 1818 links 41336 symbolic links (32871 fast symbolic links) 4 sockets -------- 781535 files Memory used: 3440k/5820k (3376k/65k), time: 63.35/ 9.86/ 4.54 I/O read: 511MB, write: 1MB, rate: 8.07MB/s
How does this compare against ext3? To answer that, I copied my entire ext4 file system to an equivalently sized partition formatted for use with ext3. This comparison is a little unfair since the ext4 file system has six weeks of aging on it, where as the ext3 filesystem was a fresh copy, so the directories are a bit more optimized. That probably explains the slightly better times in pass 2 for the ext3 file system. Still, it was no contest; the ext4 file system was almost seven times faster to check using e2fsck compared to the ext3 file system. Fsck on an ext4 filesystem is fast!
|time (s)||I/O||time (s)||I/O|
|real||user||system||MB read||MB/s||real||user||system||MB read||MB/s|