Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

May you have ever used filesystem defragmentation tools (like Norton SpeedDisk or Piriform Defraggler) on Windows, you have probably seen such a diagram:


It displays a filesystem sectors map, painting (as for this particular example) sectors (sets of sectors actually, to fit the whole partition in the screen) occupied by non-fragmented (contiguous) files in blue, the opposite in red and free sectors in white (and some more colours for some more particular cases which can happen to be of interest). You can click on a "sector" and see what particular files "live" there.

Is there such a visualization tool for Linux?

UPDATE: I've accepted sr_'s answer as it seems perfectly the answer to the question but I would be really happy to see a better option :-)

share|improve this question
up vote 9 down vote accepted

I had the same question, but there was no appropriate software. I tried to build davl, but did not succeed in that. So I ended up writing my own tool. You can find it here: https://github.com/i-rinat/fragview


Use Ctrl + mouse scroll to change map scale.

share|improve this answer
Can't make it. I've tried crating an empty "build" subdirectory and running cmake there as you write in the README.md file but it just prints cmake help. – Ivan Oct 1 '12 at 19:06
You should run "cmake ..", where ".." is directory with source. – Rinat Ibragimov Oct 1 '12 at 19:15
Kind of better but still no luck, @rinat-ibragimov: pastebin.com/X5hQAmiW (Ubuntu 10.04, 32-bit x86). – Ivan Oct 2 '12 at 1:37
@Ivan, try to install these -dev packages: apt-get install libboost-dev libsqlite3-dev libgtkmm-3.0-dev – Rinat Ibragimov Oct 2 '12 at 9:09
A way better but still no luck: pastebin.com/nsuUYafv – Ivan Oct 5 '12 at 23:32

There's dav, the "Disk Allocation Viewer" (supports ext2 and ext3; websites dates back to 2005, could be a little bit-rotted...)

visualizing the partition's fragmentation

share|improve this answer
Thanks. This seems right the answer to the question. But it is pretty rotten indeed - it seems be intended for Fedora Core 2 environment and fails to compile as is. It is going to require some C developer work to be done to animate it... – Ivan Feb 3 '12 at 18:16
I think a tool like this will be added to distros such as Ubuntu soon. With the advent of online defrag in ext4 and btrfs, it seems more appropriate. With other filesystems, the only way to defrag was to unmount the filesystem first. – Scott Hoffman Feb 3 '12 at 20:20
Unmount the filesystem first is absolutely not a problem in case of desktop use. I don't even mind rebooting from a dedicated livecd to defrag. A non-esoteric defrag tool for Linux seems a miracle for me, I don't except it to appear any soon. Now all I dare to wish is to see what does my fragmentation does look like at least (I am pretty curious actually - I want to see it with my own eyes to conclude if the "ext is not fragmentation-prone" statement is truth or just an "urban legend"). – Ivan Feb 3 '12 at 20:35
Actually, offline defrag is even better (as it doesn't have to leave any files untouched because of them being locked by processes running in parallel or the file system driver itself) and so far can be preferable for desktop use (as non-stop uptime is not required). – Ivan Feb 3 '12 at 20:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.