Linux command
filefrag 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Example
filefrag [path/to/file1] [path/to/file2]
Example
filefrag -k [path/to/file]
Example
filefrag -b[1024|1K|1M|1G] [path/to/file]
Sync
filefrag -s [path/to/file1] [path/to/file2]
Example
filefrag -v [path/to/file1] [path/to/file2]
Example
filefrag -x [path/to/file1] [path/to/file2]
Example
filefrag -X [path/to/file]
Example
filefrag -V
说明
filefrag reports on how badly fragmented a particular file might be. It shows the number of extents (contiguous blocks) for each file, which indicates fragmentation level. A file with 1 extent is not fragmented; more extents indicate higher fragmentation. Useful for identifying files that may benefit from defragmentation.
参数
- -b _blocksize_
- Use blocksize in bytes, or with KMG suffix, up to 1GB for output instead of the filesystem blocksize. If blocksize is unspecified it defaults to 1024 bytes. Must be added without any space after -b.
- -B
- Force use of the older FIBMAP ioctl instead of the FIEMAP ioctl for testing purposes.
- -e
- Print output in extent format, even for block-mapped files.
- -E
- Display the contents of ext4's extent status cache. Only supported on ext4 filesystems.
- -k
- Use 1024-byte blocksize for output (identical to '-b1024').
- -P
- Pre-load the ext4 extent status cache for the file. Only supported on ext4 filesystems.
- -s
- Sync the file before requesting the mapping.
- -v
- Be verbose when checking for file fragmentation.
- -V
- Print version number of program and library. If given twice, also print the FIEMAP flags understood by the current version.
- -x
- Display mapping of extended attributes.
- -X
- Display extent block numbers in hexadecimal format.
FAQ
What is the filefrag command used for?
filefrag reports on how badly fragmented a particular file might be. It shows the number of extents (contiguous blocks) for each file, which indicates fragmentation level. A file with 1 extent is not fragmented; more extents indicate higher fragmentation. Useful for identifying files that may benefit from defragmentation.
How do I run a basic filefrag example?
Run `filefrag [path/to/file1] [path/to/file2]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -b _blocksize_ do in filefrag?
Use blocksize in bytes, or with KMG suffix, up to 1GB for output instead of the filesystem blocksize. If blocksize is unspecified it defaults to 1024 bytes. Must be added without any space after -b.