LinuxCommandLibrary

e2freefrag

Report file system free space fragmentation

TLDR

Check how many free blocks are present as contiguous and aligned free space

$ e2freefrag [/dev/sdXN]
copy

Specify chunk size in kilobytes to print how many free chunks are available
$ e2freefrag -c [chunk_size_in_kb] [/dev/sdXN]
copy

SYNOPSIS

e2freefrag device

PARAMETERS

device
    Specifies the block device containing the ext2/3/4 filesystem to analyze. This is a mandatory parameter.

DESCRIPTION

e2freefrag is a command-line tool used to report the free space fragmentation of an ext2/3/4 filesystem. It analyzes the free blocks in the filesystem and reports the extent fragmentation information. This tool helps determine how fragmented the free space is, which can impact the filesystem's ability to allocate contiguous space for new files. This is especially important for performance reasons. It is useful for identifying filesystems that may benefit from defragmentation (using e4defrag) or a reorganization to reduce fragmentation of the free space.

e2freefrag primarily provides insights into the state of free space fragmentation. It does not directly defragment the file system, but its information aids in understanding the need for such operations. It allows the user to determine if defragging the whole filesystem or some select files is needed.

The higher the number of extents and the smaller the extent size, the higher the fragmentation level.

CAVEATS

e2freefrag only analyzes free space fragmentation. It does not provide information on file fragmentation or directly defragment the filesystem.

OUTPUT INTERPRETATION

The output of e2freefrag displays the number of free extents and their distribution based on size. A large number of small extents indicates high fragmentation. You will see information like: "Number of free extent: ", "Average size of free extent: ", "Extents/per-group: /"

HISTORY

e2freefrag was created as part of the e2fsprogs suite, which provides essential tools for managing ext2/3/4 filesystems. It was developed alongside other utilities such as fsck and tune2fs to provide comprehensive filesystem management capabilities. Usage has been consistently focused on analyzing free space fragmentation to diagnose performance issues and inform defragmentation strategies.

SEE ALSO

e4defrag(8), fsck(8), tune2fs(8)

Copied to clipboard