Where did all my space go?

This page is a mirrored copy of an article originally posted on the LShift blog; see the archive index here.

Over the last little while, I’ve started to suffer from lack of space on the hard disk in my laptop, which is ridiculous, since there’s an 80GB disk in there and there is no way I have that much data I need to hang on to. I decided to do something about it last week. The main part of the problem was to figure out what was eating all the space: du tells you exactly what’s using how much, but it’s hard to get a feel for where your space has gone by scanning through pages of du output. So I built a program to help.

spaceviz is a small Python program that takes the output of du -ak, and builds you a picture and HTML client-side imagemap of your space usage like this one:

Running it against the output of du -ak / showed me very clearly where all the space had gone: not only did I have a few seasons of various TV shows on my disk (which I already knew were there), but I had 11 GB of unneeded gzipped RDF data left over from a project that finished earlier this year (that I had forgotten about). Instant win!

To run it for yourself, check out the mercurial repository http://hg.opensource.lshift.net/spaceviz, and run

make veryclean all ROOT=/

replacing the ROOT=/ with a definition of ROOT that points at the directory tree you want to generate usage data for. The makefile will take care of running du and spaceviz.py for you. Edit the settings for WIDTH and HEIGHT in spaceviz.py to change the dimensions of the generated picture.

The program runs not only on Linux without fuss, but also on OS X so long as you have the netpbm port installed to convert the python-generated PPM file to a browser-accessible (and much more efficiently compressed!) PNG.


On 29 October, 2008 at 4:51 pm, Dmitry wrote:

GdMap produces better looking interactive image ;-)


On 29 October, 2008 at 5:25 pm, tonyg wrote:

Thanks for the pointer!

On 29 October, 2008 at 8:33 pm, masklinn wrote:

There are already software that can do that (and more, and better) with cushioned treemaps and such: KDirStat for linux, WinDirStat a windows clone and Disk Inventory X for OSX.

They offer such things as color coding (according to file types), directory trees and the ability to remove folders/files from several views.

On 29 October, 2008 at 9:14 pm, Justin wrote:

gdmap is a direct ripoff of sequoiaview! About time :D


On 29 October, 2008 at 10:49 pm, Jan wrote:

I have used xdiskusage [1] and Torta [2] (generates flash).

[1] http://xdiskusage.sourceforge.net/
[2] http://wiki.freaks-unidos.net/torta

On 30 October, 2008 at 3:03 pm, matthew wrote:

And of course, the original is FSV (http://fsv.sourceforge.net/) which I think is a rewrite of the original that was written by SGI and appeared in Jurassic Park.

On 3 December, 2008 at 12:24 pm, Olivier Aubert wrote:

Yet another similar app : Filelight (kde-based) http://www.methylblue.com/filelight/ Compared to the previously mentioned ones, I find its pie visualisation more convenient.

On 28 March, 2009 at 1:21 pm, David Keech wrote:

I know I’m a little bit late weighing in on this topic but I thought it was worth mentioning that you can achieve this with nothing but the Finder.

Go to View -> Show View Options and select the “Calculate all sizes” check box. Then just sort your Finder window by size in List view.

On 30 March, 2009 at 10:03 am, tonyg wrote:

@David: ha! Fabulous! Thank you. I should have guessed :-)

On 20 April, 2009 at 12:56 pm, Dick Davies wrote:

GrandPerspective is another one; bit faster than some of the others IMO.

On 31 August, 2009 at 11:42 am, Michal Chruszcz wrote:

There’s a perfect Mac OS X tool for finding garbage on your disk with awesome interface: Daisy Disk (http://www.daisydiskapp.com/). I use it from time to time and it always happens I find something saving me some free space. :-)