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 whether e4defrag should 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

mke2fs(8), mount(8) ๐ŸŒท


that's a wrap, bestie ๐ŸŽ€ e4defrag version 2.0 ยท May 2009 ยท E4DEFRAG(8) ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from