[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

Baobab/Disk Usage Analyzer

Filed under: GNOME,Hacking — Thomas @ 11:00 pm

2009-9-14
11:00 pm

Usually when I run out of space on my laptop I do a du –max-depth=1 to a file in my home dir, wait, look at it, then drill down to the biggest dir and repeat. I find some stuff, delete some stuff, free up some space, then continue.

Each time I think ‘there’s got to be a better way to do this’, and today I remembered the name ‘baobab’. I was surprised to find out that a) this was already included by default in GNOME and b) already installed on my system. I didn’t find it where the online docs said I would (on my F-11 system it’s under System Tools instead of Accessories – I’m guessing that’s a Fedora decision).

It took a while to run on my home directory (about 10 minutes I think), but I just used to drill down to a few levels, and freed up 2.5 GB of space in under 5 minutes. With my manual system I’m lucky if I delete half a gig in 15 minutes!

Excellent, excellent tool, and flawlessly executed. Apart from launching it I didn’t need to learn anything, it just worked as expected, and it told me what I needed to know in less time than before. Fabio Marzocca, you’re my hero of the week!

14 Comments »

  1. I think Ubuntu have moved in to Accessories, the upstream location is System Tools.

    Comment by Bruce Cowan — 2009-9-15 @ 12:33 am

  2. You obviously understand its interface well, that’s good; personally I found it quite confusing (and opted to use pysize http://guichaz.free.fr/pysize/ instead, which I like for it’s straightforward representation and ability to directly queue deletions.) — specifically it’s the pie ‘graph’ that I find confusing.

    Comment by David Gowers — 2009-9-15 @ 2:15 am

  3. You can always use something like this as well. I can’t remember where I found this, but it works very well. The only thing I added was the ability to enter the minimum size of the file to look for. I like it because I can run it anywhere where I have a bash shell. I don’t need a gui.

    #!/bin/bash
    # if nothing is passed to the script, show usage and exit
    [[ -n "$1" ]] || { echo “Usage: findlarge [PATHNAME]“; exit 0 ; }
    # simple using find, $1 is the first variable passed to the script
    echo “”
    echo “*** Search for large files in a filesystem***”
    echo -n “Enter the size of the file in Megabytes and then press [ENTER]:”
    read size
    find $1 -type f -size +”$size”M -exec ls -lh {} \; | awk ‘{ print $8 “: ” $5 }’

    -Tim

    Comment by Tim — 2009-9-15 @ 2:21 am

  4. you might try “du -ckx”

    -john

    Comment by john — 2009-9-15 @ 2:48 am

  5. the opensuse servers at my employer run baobob alot.. wonderful application

    Comment by Justin Haygood — 2009-9-15 @ 4:29 am

  6. Your comments did not show up in my FF versions 3.5.3

    also take a look at this
    http://shibuvarkala.blogspot.com/2008/12/gt5-disk-usage-browser-for-ubuntu-linux.html

    Comment by pvandewyngaerde — 2009-9-15 @ 10:03 am

  7. even better than baobab: gdmap

    Comment by Matteo — 2009-9-15 @ 10:12 am

  8. Another interesting tool is agedu: it records the last-access times of every file it scans and then it generates an HTML report. The space occupied by each directory is represented by a coloured bar, drawn in lots of different colours: red for files that haven’t been looked at for a long time, green for very recently accessed files, and a whole colour spectrum for the points in between. So you can immediately see that a specific subdirectory is not only the largest, but also that it consists mostly of files you haven’t looked at for months.

    http://www.chiark.greenend.org.uk/~sgtatham/agedu/

    Comment by Koen Vervloesem — 2009-9-15 @ 11:36 am

  9. The better way you were looking for was:

    du -acx ~ | sort -n

    Comment by Justin — 2009-9-15 @ 3:36 pm

  10. Visually I still prefer KDE’s FileLight, which afaict was there *way* before baobab.

    Comment by Jinks — 2009-9-16 @ 12:16 pm

  11. Thank you Thomas! I’m glad to know you find it useful.

    Fabio

    Comment by Fabio Marzocca — 2009-9-17 @ 11:32 am

  12. @Matteo: I have to violently disagree. I just tried gdmap. It was already confusing to figure out how to make it scan my home directory (arguably partly to blame there is the file selector, but even still, after thinking I selected my /home/thomas directory it took it quite a while and only then did it show me it actually scanned /home instead) and I have no idea what to do with all the coloured different-sized squares I now see. How is that useful ? I see colours that I don’t understand, squares I can mouse-over that seem to point at some directories. I don’t easily see the first-level grouping (although I do see when I mouseover that some cyan rectangle is outlining them, but mouseover hunt and peck is hardly a good interface.)

    I’m terribly unimpressed at gdmap and it definitely is not going to help me figure out the bigger disk wasters in 5 minutes.

    Comment by Thomas — 2009-9-19 @ 12:38 pm

  13. I’d prefer to do this from within Nautilus — the “size” column should not show a mix of filesizes and directory object counts. I find the directory object counts to be useless. I’d much rather know how much data is in a directory. So I’d like Nautilus to recursively add up the sizes of everything in a directory and present that size to me for the size of that directory, just as Nautilus does if you get info on a directory. I believe the MacOS Finder has behaved this way in “list view” for quite some time. I filed an improvement bug against Nautilus to this effect. I’m learning Python and plan to investigate writing a Python extension to get Nautilus to do what I want.

    As for using the command-line, I can do that but my GUI-dependent colleagues cannot do that as easily. I find all of the graphs I’ve seen (Pysize’s graph, Baobab’s graph, etc.) to be unclear and undesirable. I’d much prefer an integrated approach for this, hence getting Nautilus to do what I want.

    Comment by J.B. Nicholson-Owens — 2009-9-19 @ 10:08 pm

  14. du is ok but ncdu is better :-) It’s du in an interactive ncurses interface so you can toggle sorting by name/size, toggle being asked before delete, toggle dirs before files when sorting, show percentage and/or graph, between apparent size and disk usage, between powers of 1000 and 1024. If you make any changes you press ‘r’ and it recalculates. It works very efficiently just like du. You can have it stay within the filesystem and you can run it on individual directories.

    It’s very simple, has built in help menu, and looks nice so is just as suitable for a GUI desktop as it is when used on a console system (i.e. remote machine via ssh). I have it as a Thunar custom action (file manager right click context menu) on my desktop and laptop and I even managed to build a package for my not-powerful Nokia N810 (armel). I assume it can be integrated into other GUI file manager context menus as well but I’m not really familiar with Nautilus and Konqueror etc.

    Comment by Julian Hughes — 2009-9-29 @ 9:42 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

picture