2. 2 / 5
File Fragmentation
Fragmentation happens when there is not a large enough block of
contiguous free space available on a file system when a file is being
written. The result is that the file's data is split into multiple groups of
contiguous blocks, which are dispersed across the hard drive.
3. 3 / 5
Issue in File Fragmentation
Disk Operations
request will increased
Negatively impact
Disk Performance
Affect File
System Performance.
Increasing time to
complete disk
service request.
4. 4 / 5
Fragmentation XFS
● Report fragmentation for “XFS” file system
xfs_db -c frag -r “disk-name”
● Report the number of extents for largefile for both file systems
“XFS or EXT4”
filefrag -v largefile
● Defragmentation for both largefile or mount file
xfs_fsr -v “largefile or “mount-point”
5. 5 / 5
Fragmentation EXT4
● Report fragmentation for “ext4” file system
fsck -fn “disk-name”
● Report the number of extents for largefile for both file systems “XFS or
EXT4”
filefrag -v largefile
● Defragmentation for both largefile, mount file, or specific dir
e4defrag -v “largefile, mount-point, or specific dir”
e4defrag -c “largefile, mount-point, or specific dir”
A useful -c option can be used to calculate fragmentation and
determine whether defragmentation is necessary.
6. 5 / 5
Fragmentation EXT4
● Report fragmentation for “ext4” file system
fsck -fn “disk-name”
● Report the number of extents for largefile for both file systems “XFS or
EXT4”
filefrag -v largefile
● Defragmentation for both largefile, mount file, or specific dir
e4defrag -v “largefile, mount-point, or specific dir”
e4defrag -c “largefile, mount-point, or specific dir”
A useful -c option can be used to calculate fragmentation and
determine whether defragmentation is necessary.