Estimate filesystem fragmentation percentage from free extent counts and file counts.
Fragmentation occurs when a file's data is split across non-contiguous extents on disk instead of one continuous run, forcing extra seeks to read it sequentially. filefrag -v (ext4) or xfs_db frag (XFS) reports extent counts you can feed into this calculator. The performance impact depends heavily on storage type: HDDs suffer real seek-time penalties from fragmentation, while SSDs' near-zero seek latency makes fragmentation largely a non-issue — defragmenting an SSD mostly just adds unnecessary write wear.
Fragmentation percentage
fragmentation% = (non_contiguous_extents / total_extents) × 100
Rarely. ext4's allocator (multiblock allocation, delayed allocation) actively avoids fragmentation at write time, so under normal use fragmentation stays low. It becomes noticeable mainly on filesystems that stay nearly full for long periods, forcing the allocator to scatter writes into small gaps.
Run `filefrag -v <file>` for a single file's extent map, or `e2freefrag /dev/xxx` for a filesystem-wide free-space fragmentation summary. e4defrag can defragment individual files or whole filesystems if needed.
Not for performance — SSDs have effectively uniform access latency regardless of physical layout, so fragmented reads cost little extra. The remaining concern is write amplification from defrag tools themselves, which is why defragmenting SSDs is generally discouraged.