FILEFRAG(8)
๐ FILEFRAG(8) ๐
okay bestie, welcome to filefrag โ a lil' tool from the System Manager's Manual section 8 (that's the sysadmin zone, we love her) ๐
โจ NAME โจ
filefrag โ the girl who reports on file fragmentation ๐
๐ธ SYNOPSIS ๐ธ
filefrag [ -bblocksize ] [ -BeEkPsvVxX ] [ files... ]
๐ฆ DESCRIPTION ๐ฆ
So basically, filefrag spills the tea on how badly fragmented a particular file might be. It's giving investigative journalism but for your disk ๐ต๏ธโ๏ธโจ
It makes allowances for indirect blocks for ext2 and ext3 file systems โ cute of it โ but fr fr it can be used on files for any file system. No gatekeeping here ๐
The filefrag program initially attempts to get the extent information using FIEMAP ioctl, which is more efficient and faster (main character energy, no cap). And if FIEMAP is not supported? Bestie, it doesn't panic โ it falls back to using FIBMAP. Lowkey resilient ๐ช
๐ OPTIONS ๐
-Bโ Force the use of the olderFIBMAPioctl instead of theFIEMAPioctl, for testing purposes. Retro era activated ๐ฐ๏ธ-bblocksizeโ Use blocksize in bytes, or with[KMG]suffix, up to1GB, for output instead of the file system blocksize. For compatibility with earlier versions offilefrag, if blocksize is unspecified it defaults to1024bytes. And hear me out: since blocksize is an optional argument, it must be added without any space after-b. No space. Zero. Not even one. She's sensitive about it ๐ญ-eโ Print output in extent format, even for block-mapped files. Extent format era, periodt โจ-Eโ Display the contents ofext4's extent status cache. Heads up though: this feature is not supported on all kernels, and it is only supported onext4file systems. So check before you get attached ๐-kโ Use1024-byte blocksize for output (identical to'-b1024'). Same vibe, shorter name ๐-Pโ Pre-load theext4extent status cache for the file. Same disclaimer as before, bestie: not supported on all kernels, and only supported onext4file systems ๐-sโ Sync the file before requesting the mapping. Get it together first, then ask ๐ซ-vโ Be verbose when checking for file fragmentation. She's a talker and honestly? We stan ๐ฃ๏ธ-Vโ Print version number of program and library. And if you give it twice, it also prints theFIEMAPflags that are understood by the current version. Double tap for extra lore ๐โจ-xโ Display mapping of extended attributes. xattrs, but make it visible ๐-Xโ Display extent block numbers in hexadecimal format. Hex girlies rise up ๐ฅ
๐ซถ AUTHOR ๐ซถ
filefrag was written by Theodore Ts'o <tytso@mit.edu>. Shoutout to the icon who built her ๐
ngl bestie, if you're checking fragmentation on anext4box and-Eor-Pjust quietly doesn't work? That's the kernel talking, not you. It's literally not supported on all kernels. Not your fault, babe ๐ญ
and that's the whole page, bestie!! this one's from E2fsprogs version 1.47.4, dated March 2025 โ so it's fresh, it's current, it ate and left no crumbs ๐ธโจ๐ฆ mwah, go defrag something (or don't, it's a report tool, love that for us) ๐๐
๐ฆ where this page comes from
- alpine 3.24: e2fsprogs-doc 1.47.4-r0 ยท GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT
- arch rolling: e2fsprogs 1.47.4-1 ยท GPL AND LGPL AND MIT
- nixpkgs unstable: e2fsprogs 1.47.4
- ubuntu stonking: e2fsprogs 1.47.4-1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms