6.19. Fragmentation Example
> xfs_db –r device
xfs_db: freesp
from to extents blocks pct
1 1 94807 94807 1.36
2 3 63041 145012 2.08
4 7 30374 152890 2.19
8 15 19437 207742 2.98
16 31 15173 331559 4.76
32 63 14099 636086 9.13
64 127 16804 1497220 21.48
128 255 8390 1470464 21.10
256 511 3003 1033383 14.83
512 1023 810 551813 7.92
1024 2047 258 370811 5.32
2048 4095 101 282202 4.05
4096 8191 27 145550 2.09
xfs_db: frag -d
actual 45966, ideal 12398, fragmentation factor 73.03%
xfs_db: frag -f
actual 2104856, ideal 2100484, fragmentation factor 0.21%
Note
The fragmentation factor value can be misleading.
It is derived from (actual - ideal) / (ideal) so an average of 5 extents per file will yield 80%. For multi-gigabyte files, 5 extents is not harmful, and the 80% is not representative of a problem.