How to check the fragmentation and do defragmentation on ext4? Helpful check for home directory of application
Today, I got a question about how to check the fragmentation of ext4 filesystems, as most common for the Data Center edition or Server edition setups.
That article is the next step of a previous story about the improvement of latency for volumes.
Of course, some users can ask why we need to do defragmentation on ext4 as it’s not fragmented. As an answer, I would recommend checking out the presentation from LinuxCon 2010 with the name Outline of Ext4 File System & Ext4 Online Defragmentation Foresight and watch the small video with fragmentation
So let’s start to use one small command line utility e4defrag.
Online man page you can find here: http://manpages.ubuntu.com/manpages/focal/man8/e4defrag.8.html
Get report of fragmentation:
$ sudo e4defrag -c /location
After checking the results you can run the defragmentation:
$ sudo e4defrag /location
If you want extra info:
$ man e4defrag
This is result on out test env:
Reference:
Akira Fujita - Outline of Ext4 File System & Ext4 Online Defragmentation Foresight - https://events.static.linuxfound.org/slides/2010/linuxcon_japan/linuxcon_jp2010_fujita.pdf
Takashi Sato - ext4 online defragmentation - https://www.kernel.org/doc/ols/2007/ols2007v2-pages-179-186.pdf
Source code of utility - https://github.com/tytso/e2fsprogs/blob/master/misc/e4defrag.c
Previous article: The story about how to improve the background indexing Lucene job for Jira in one shot
Comments
Post a Comment