finding large directories 30. Oct 2007

Every once in a while there is the need to clear out the system. The question that inevitably pops up is: Where has all the disk space gone ? The solution of course lies in locating the largest directories. With WhatSize and OmniDiskSweeper there are two great tools on Mac OS X. There are also feasible Tools on Linux like Filelight, but if you’re administering a remote server and you don’t want to use remote x11 access you need a solution that can be controlled either on the command line or via browser. Of course you could use sturdy old du.


# Find all directories with the largest directories on top
$ sudo du -Sx / | sort -nr | less
# Find directories over 100MB with the largest directories on top
$ sudo du -Sh / | grep ^[1-9][0-9][0-9][0-9\.]*M | sort -nr

Or you could hack together some fancy perl script, but wouldn’t it be nice to have an interactive graphical visualisation through which you could comfortably navigate ? This is where Philesight pops in, which offers both command line and browserbased control. Putting it up on Debian is a breeze. Just install cairo and berkley db and their ruby bindings and then get rolling.


$ wget http://zevv.nl/code/philesight/philesight-2035.tgz
$ tar xvfz philesight-2035.tgz
$ sudo apt-get install libcairo2 libcairo-ruby
$ sudo apt-get install libdb4.2 libdb4.2-ruby1.8
# Generate index
$ sudo ./philesight --db base.db --index /
# Check if image is correctly generated
$ ./philesight --db base.db --path / --draw base.png

Firing up the web interface is just three small steps further. First configure the CGI-File.


# philelight.cgi
db = "./base.db"
default_path = "/"

Then create a reasonably named subdomain and after that just add a few lines to your lighttpd configuration file (or the corresponding lines to the webserver of your choice).


$HTTP["host"] =~ "philesight.yourdomain.net" {
  cgi.assign = ( ".cgi" => "/usr/bin/ruby" )
  alias.url = ( "/" => "/path/to/philesight/philesight.cgi")
  server.document-root = "/path/to/philesight"
}

That’s all there’s to it. Have fun.

 

Kommentare (694)

  1. bjoern 5 days later

    Ich verwende immernoch disk usage. Filelight ist mir zu instabil.

Kommentar schreiben

Markdown Syntax