// HACKER NEWS — CYBERSECURITY
Show HN: I missed the moving blocks, so I built a real Linux disk defragmenter
A real graphical defragmenter for Linux. Occasionally useful but weirdly satisfying.
After moving to Linux, 20+ years ago ... I discovered that the Windows utility I missed most was
the graphical disk defragmenter.
Not because modern Linux filesystems need a weekly defrag ritual. The old block
map was one of those accidental interfaces that made the machine legible: you
could actually watch the filesystem reorganize itself.
Then recently I needed a reproducible storage layout while testing a high-throughput
logger. Fragmentation and extent allocation were adding measurable variance,
even on NVMe, so the nostalgia project became a real filesystem tool.
Defragger shows how files, free space, and filesystem metadata are allocated,
finds fragmented files, and can reorganize supported filesystems without
shelling out to e4defrag or filefrag.
This is alpha filesystem software. Back up important data. The ext4 path has
received the most testing. FAT write support is newer and should first be
used with disposable or fully backed-up volumes.
This decompresses the repository's deliberately fragmented ext4 fixture,
attaches the copy as a temporary loop device, and opens Defragger. Select the
loop device printed in the terminal. Closing Defragger detaches and deletes the
temporary image; the demo does not write to your real volumes.
The demo needs just, zstd, loop-device support, and sudo for attaching the
temporary image. The application itself remains unprivileged.
Defragger is not a wrapper around existing command-line tools.
For ext4, it obtains filesystem allocation maps through FS_IOC_GETFSMAP, maps
individual files through FS_IOC_FIEMAP, and moves extents using the kernel's
EXT4_IOC_MOVE_EXT interface.