Filesystem Fragmentation Calculator
Estimate filesystem fragmentation percentage from free extent counts and file counts.
Inputs
Fragmentation Percentage
12.00%
Severity
Moderate — worth monitoring, not yet a performance concern.
Average Extents per File
2.00
Recommendation
On SSD/NVMe, fragmentation has minimal performance impact due to random-access speed — defragmentation is generally unnecessary and adds needless write wear.
Step by step
Values used
Total Extents (from filefrag/xfs_db) = 1,000; Non-Contiguous Extents = 120; Total Files Sampled = 500; Storage Type = SSD / NVMe
Fragmentation percentage
fragmentation% = (non_contiguous_extents / total_extents) × 100
Fragmentation Percentage
= 12.00
Severity
= Moderate — worth monitoring, not yet a performance concern.
Average Extents per File
= 2.00
Recommendation
= On SSD/NVMe, fragmentation has minimal performance impact due to random-access speed — defragmentation is generally unnecessary and adds needless write wear.
How it works
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.
Formula
Fragmentation percentage
fragmentation% = (non_contiguous_extents / total_extents) × 100
- E_nc
- non-contiguous extents
- E_total
- total extents
Frequently Asked Questions
Does ext4 need regular defragmentation like old Windows filesystems did?
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.
How do I check fragmentation on ext4?
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.
Is fragmentation a concern on SSDs?
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.