LinuxCommandLibrary

filefrag

filesystem fragmentation report utility

TLDR

Display fragmentation report for files

$ filefrag [path/to/file1] [path/to/file2]
copy
Report using 1024 byte blocksize
$ filefrag -k [path/to/file]
copy
Report using specific blocksize
$ filefrag -b[1024|1K|1M|1G] [path/to/file]
copy
Sync file before requesting mapping
$ filefrag -s [path/to/file1] [path/to/file2]
copy
Display mapping of extended attributes
$ filefrag -x [path/to/file1] [path/to/file2]
copy
Display verbose report
$ filefrag -v [path/to/file1] [path/to/file2]
copy

SYNOPSIS

filefrag [options] files

DESCRIPTION

filefrag reports how badly fragmented files are on the filesystem. It shows the number of extents (contiguous blocks) for each file, which indicates fragmentation level.
Useful for identifying files that may benefit from defragmentation.

PARAMETERS

-b blocksize

Use specified block size
-k
Use 1024-byte blocksize
-s
Sync file before mapping
-v
Verbose output with details
-x
Show extended attribute mappings

CAVEATS

Part of e2fsprogs. Works best on ext2/ext3/ext4 but supports other filesystems. Number of extents indicates fragmentation level.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community