- Display a report for a specific file:
- Display a report for space-separated list of files:
filefrag path/to/file1 path/to/file2
- Display a report using a 1024 byte blocksize:
filefrag -b path/to/file
- Sync the file before requesting the mapping:
filefrag -s path/to/files
- Display mapping of extended attributes:
filefrag -x path/to/files
- Display a report with verbose information:
filefrag -v path/to/files
filefrag [ -bblocksize ] [ -BeEkPsvVxX ] [ files... ]
filefrag reports on how badly fragmented a particular file might be. It makes allowances for indirect blocks for ext2 and ext3 file systems, but can be used on files for any file system.
The filefrag program initially attempts to get the extent information using FIEMAP ioctl which is more efficient and faster. If FIEMAP is not supported then filefrag will fall back to using FIBMAP.
Force the use of the older FIBMAP ioctl instead of the FIEMAP ioctl for testing purposes.
Use blocksize in bytes, or with [KMG] suffix, up to 1GB for output instead of the file system blocksize. For compatibility with earlier versions of filefrag, if blocksize is unspecified it defaults to 1024 bytes. Since blocksize is an optional argument, it must be added without any space after -b.
Print output in extent format, even for block-mapped files.
Display the contents of ext4's extent status cache. This feature is not supported on all kernels, and is only supported on ext4 file systems.
Use 1024-byte blocksize for output (identical to '-b1024').
Pre-load the ext4 extent status cache for the file. This is not supported on all kernels, and is only supported on ext4 file systems.
Sync the file before requesting the mapping.
Be verbose when checking for file fragmentation.
Print version number of program and library. If given twice, also print the FIEMAP flags that are understood by the current version.
Display mapping of extended attributes.
Display extent block numbers in hexadecimal format.
filefrag was written by Theodore Ts'o <email@example.com>.