Filesystem Fragmentation Calculator
Estimate filesystem fragmentation percentage from free extent counts and file counts.
About Filesystem Fragmentation Calculator
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
Worked example
With the default values below, Filesystem Fragmentation Calculator returns Fragmentation Percentage of 12.00%. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Total Extents (from filefrag/xfs_db)minimum 1
- 1,000
- Non-Contiguous Extentsminimum 0
- 120
- Total Files Sampledminimum 1
- 500
- Storage Typeone of SSD / NVMe, HDD (spinning disk)
- SSD / NVMe
Results
- 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
- 1Values used
- 2Fragmentation percentage
- 3Fragmentation Percentage= 12.00
- 4Severity= Moderate — worth monitoring, not yet a performance concern.
- 5Average Extents per File= 2.00
- 6Recommendation= On SSD/NVMe, fragmentation has minimal performance impact due to random-access speed — defragmentation is generally unnecessary and adds needless write wear.
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
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.
