gitwtfhub

wtf is linux-defragger?

the-infiltratr/linux-defragger — explained in plain English

Analysis updated 2026-05-18

0PythonAudience · ops devopsComplexity · 5/5Setup · hard

TL;DR

A Linux desktop and command-line tool that analyzes filesystem fragmentation and reorganizes files and free space across many filesystem types.

Mindmap

mindmap
  root((linux defragger))
    What it does
      Analyse fragmentation
      Compact free space
      Defragment files
      Growth Defrag for FAT
    Tech stack
      Python
      GTK interface
      Filesystem plugins
    Use cases
      Drive maintenance
      Filesystem cleanup
      Recovery from interruption
    Audience
      System administrators
      Advanced Linux users

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Check how fragmented a Linux drive's files and free space are before deciding whether to clean it up.

REASON 2

Defragment files on an ext4, Btrfs, or XFS drive to rebuild them into continuous blocks.

REASON 3

Compact free space toward the end of a FAT or exFAT drive and leave growth room after each file.

What's in the stack?

PythonGTKLinux kernel ioctls

How it stacks up

the-infiltratr/linux-defragger0xallam/my-recipe0xhassaan/nn-from-scratch
Stars00
LanguagePythonPythonPython
Last pushed2022-11-22
MaintenanceDormant
Setup difficultyhardmoderatemoderate
Complexity5/52/54/5
Audienceops devopsgeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · hard Time to first run · 1h+

Requires root-level access and direct interaction with disk partitions, mistakes can affect filesystem data layout.

Wtf does this do

Linux Defragger is a desktop tool for Linux that examines a hard drive or storage device, shows how full and scattered its files are, and can reorganize them so the storage runs more smoothly. It works with many different storage formats, including FAT, exFAT, NTFS, ext4, Btrfs, XFS, and older formats used by Apple and Amiga systems, though the exact features supported vary by format. The program splits its work into distinct, separate operations rather than one big automatic fix. Analyse simply looks at a drive and reports how fragmented it is, without changing anything. Compact moves the free space on a drive toward the end of it, so large unused areas are grouped together instead of scattered in gaps. Defragment rebuilds files that have been split into pieces so each file sits in one continuous block again. Growth Defrag, a feature specific to FAT and exFAT formatted drives, rebuilds files in their current order but deliberately leaves a bit of extra room after each file, so the file has space to grow later without immediately fragmenting again. For newer Linux filesystems like ext4, the Compact process runs a filesystem check, shrinks the filesystem down to its smallest safe size, and then repeats this in rounds if it needs to move files out of small gaps first. Btrfs and XFS have their own native compacting methods built on tools already provided by the Linux kernel. Some older or more unusual filesystems, like ext2 and ext3, only support the read-only analysis feature rather than actually rearranging files. The tool has a graphical interface built with GTK that shows a visual map of how a drive's space is used, plus a command line option for users who want more detail or want to run it as part of a script. It also keeps a journal of the changes it makes during an operation, so if a rearrangement is interrupted partway through, an included recovery feature can finish the job safely instead of leaving the drive in a broken state. This is a fairly advanced, low-level system tool aimed at people comfortable working directly with disk partitions and filesystem internals, rather than an everyday consumer utility, since mistakes at this level can affect how a drive's data is stored.

Yoink these prompts

Prompt 1
Explain the difference between Analyse, Compact, and Defragment in this tool and when I would use each one.
Prompt 2
Walk me through running Growth Defrag on a FAT32 USB drive using the command line interface.
Prompt 3
Explain how the journal and recovery feature protect a drive if a defragmentation operation is interrupted.
Prompt 4
What filesystem types does this tool fully support for defragmenting versus read-only analysis only?

Frequently asked questions

wtf is linux-defragger?

A Linux desktop and command-line tool that analyzes filesystem fragmentation and reorganizes files and free space across many filesystem types.

What language is linux-defragger written in?

Mainly Python. The stack also includes Python, GTK, Linux kernel ioctls.

How hard is linux-defragger to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is linux-defragger for?

Mainly ops devops.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.