E4DEFRAG(8)
โจ E4DEFRAG(8) ยท System Manager's Manual โจ
๐ NAME
e4defrag โ online defragmenter for ext4 file system ๐ง
๐ SYNOPSIS
e4defrag [ -c ] [ -v ] target ...
๐ธ DESCRIPTION
okay so e4defrag is the tool that reduces fragmentation of extent based files ๐ซถ The file you point it at has to live on an ext4 file system that was made with the -O extent option (see mke2fs(8)) ๐
Once it's done, your file gets more contiguous blocks and it's literally faster to access โจ
target can be a regular file, a directory, or a device that's mounted as an ext4 file system ๐ฆ If you give it a directory, e4defrag goes through and defrags every file in there. If you give it a device, it finds the mount point and defrags all the files under that mount point. main character energy, fr ๐
๐ OPTIONS
-cโ this one is a vibe check ๐ It grabs the current fragmentation count and the ideal fragmentation count, then works out a fragmentation score from them. Looking at that score tells you whethere4defragshould actually be run on the target ๐ If you pair it with-v, you get both counts printed for each file.
It also prints the average data size in one extent ๐ If you see that number, you can tell whether the file has ideal extents or not. Heads up: the maximum extent size in an ext4 file system is 131072KB (if the block size is 4KB) ๐ค
If you use this option, target is never defragmented ๐ It's just a look, no touching.
-vโ prints error messages, plus the fragmentation count before and after defrag for each file ๐ฃ
๐ฆ NOTES
okay pay attention bestie ๐ e4defrag does not support swap files, files in the lost+found directory, or files allocated in indirect blocks ๐
โโ๏ธ When your target is a device or a mount point, it won't defrag files that live in the mount point of some other device ๐ซ
It's safe to run e4defrag on a file while another application is actively using it โจ The file block contents get copied through the page cache, though, so both e4defrag and the app can slow down because they're fighting over memory and disk bandwidth ๐ญ
If the file system's free space is fragmented, or there isn't enough free space at all, e4defrag might not be able to improve the file's fragmentation ๐
Non-privileged users can run e4defrag on their own files, but if you use the -c option the score doesn't get printed ๐ฅบ So it's really best to run it as the root user ๐
๐ซถ AUTHOR
Written by Akira Fujita <a-fujita@rs.jp.nec.com> and Takashi Sato <t-sato@yk.jp.nec.com> ๐
๐ SEE ALSO
that's a wrap, bestie ๐ e4defrag version 2.0 ยท May 2009 ยท E4DEFRAG(8) ๐ โจ
๐ฆ where this page comes from
- alpine 3.22: e2fsprogs-doc 1.47.2-r2 ยท GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT
- alpine 3.23: e2fsprogs-doc 1.47.3-r0 ยท GPL-2.0-or-later AND LGPL-2.0-or-later AND BSD-3-Clause AND MIT
- 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
- centos-stream 10: e2fsprogs 1.47.1-5.el10 ยท GPL-2.0-only
- centos-stream 9: e2fsprogs 1.46.5-8.el9 ยท GPLv2
- debian bookworm: e2fsprogs 1.47.0-2+b2 ยท GPL-2.0-only
- debian trixie: e2fsprogs 1.47.2-3+b12 ยท GPL-2.0-only
- fedora 43: e2fsprogs 1.47.3-2.fc43 ยท GPL-2.0-only
- fedora 44: e2fsprogs 1.47.3-4.fc44 ยท GPL-2.0-only
- nixpkgs unstable: e2fsprogs 1.47.4
- opensuse-leap 16.0: e2fsprogs 1.47.0-160000.3.2 ยท GPL-2.0-only
- opensuse-leap 16.0: e2fsprogs 1.47.0-160000.3.2 ยท GPL-2.0-only
- opensuse-leap 16.0: e2fsprogs 1.47.0-160000.3.2 ยท GPL-2.0-only
- opensuse-leap 16.0: e2fsprogs 1.47.0-160000.3.2 ยท GPL-2.0-only
- ubuntu jammy: e2fsprogs 1.46.5-2ubuntu1
- ubuntu jammy: e2fsprogs 1.46.5-2ubuntu1.1
- ubuntu jammy: e2fsprogs 1.46.5-2ubuntu1.2
- ubuntu noble: e2fsprogs 1.47.0-2.4~exp1ubuntu4 ยท GPL-2.0-only
- ubuntu noble: e2fsprogs 1.47.0-2.4~exp1ubuntu4.1 ยท GPL-2.0-only
- ubuntu questing: e2fsprogs 1.47.2-3ubuntu2 ยท GPL-2.0-only
- ubuntu resolute: e2fsprogs 1.47.2-3ubuntu4 ยท GPL-2.0-only
- ubuntu stonking: e2fsprogs 1.47.4-1 ยท GPL-2.0-only
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms