Fight File System Bloat with Baobab

Find the files that are hogging your hard drive with with Baobab.
Over the last decade, the size of the hard drive that ships in a moderately-priced computer has grown from a paltry 1 GB, to 5 GB, 10 GB, 20 GB, 60 GB, all the way up to 160 GB in recent months. But even such a mammoth drive as the latter fills quickly nowadays, as the demand for storage continues to keep pace or even outpace gains in capacity. Along with bigger hard drives has come an explosion of files: more and more files are stored on a machine, and the files are larger and larger, in some cases up to hundreds of megabytes or larger per file. As implausible as it sounds, it is possible to quickly fill a 160 GB drive, especially if you’ve partitioned your system. And there’s nothing worse than a /home partition with a scant 5 MB of space left.
But what’s taking up all that space?
Longtime Linux users who proudly sport a BOUB (“Big Ol’ Unix Beard”) typically use some combination of command-line tools such as du, grep, and find to catalog disk contents. KDE folks can turn to KDirStat, a nice graphical tool that represents disk space usage in a colorful, easy-to-use display. The coolest and most useful graphical tool, however, belongs to GNOME, but will work in any desktop environment that has the essential GNOME libraries. It’s powerful, works on your local machine or over a network, provides a variety of ways to view your disk allocation, and lets you search for files on your system. It’s name? Baobab.
You can find Baobab at http://www.gnome.org/projects/baobab. Debian users can pick it up with the simple apt-get install baobab, and others can find a variety of packages and source code on the web site. Once installed, launch the program.
Baobab doesn’t look like much at first, but suspend your disbelief for a moment. Select “Actions& gt; Scan a selected directory” and when asked for a directory to scan, find your /home directory and press the Open button. Baobab instantly goes to work, parsing that directory and writing the results in the main Baobab window on the “Directory tree” tab. The more stuff in that directory, the longer the process takes. When it finishes, you’ll have an expandable tree structure showing you the size of each subdirectory and file in /home.
By default, Baobab sorts the results by name, which is useful is you want to know how big directory foo is compared to directory bar, but not so handy if you want to ferret out the disk hogs. To get that information, select the “Sort& gt; By size”.
Right-click on a directory to view a useful menu of options, including “Open” (which shows you the contents of the directory in your default file manager), “Delete” (which permanently destroys the directory, so be careful), “List all files in folder”, and, perhaps most useful, “Folder graphical map”. The latter option presents a visual representation of a directory, as shown in Figure One.
FIGURE ONE: Now you can view the contents of a file system or directory in technicolor, courtesy of Baobab

Baobab’s graphical map displays each subdirectory as a colored box, with the size of the box proportional to the size of the subdirectory. With just a glance, it’s incredibly simple to tell that a particular item is grotesquely overgrown in comparison to others. Hover your mouse over any box, and Baobab pops up the path for that subdirectory.
Choose the “Actions” menu to “Scan a selected directory”, “Scan the whole filesystem”, or even “Scan a remote folder”. The latter option is really cool, as Baobab supports SSH, FTP, Samba, and WebDAV.
Finally, the “Actions” menu also allows you to “Search for a file”, a useful feature. The results of the search include some nice metadata, including the file’s full path, modification date, owner, size, and file type. Nice! Baobab is a useful tool, and its network features make it especially powerful.
Even though disks are getting bigger, Penguinistas are still finding ways to fill them up. Baobab can help you tame the hard drive beast.

Scott Granneman teaches at Washington University in St. Louis, consults for WebSanity, and writes for SecurityFocus and Linux Magazine. His latest book, Don’t Click on the Blue E!:Switching to Firefox, is in stores now. You can reach Scott at class="emailaddress">scott@granneman.com.

Comments are closed.