December 17, 2008

Where has my disk space gone?

Author: Federico Kereki

If Parkinson's Law for computers holds true, then no matter how much disk space you have, it will get used up. If you're already feeling a pinch, consider using a disk space analyzer tool to see what's eating your space.

Filelight is designed for KDE, but will work in other desktop environments. The latest version hails from September 2006, though a KDE 4 version is (vaguely) promised; the author is "getting round to it." Filelight is included with most distributions, so installation is easy via a package manager. Filelight also works as a Konqueror plugin; once you have installed it, Konqueror will enable a new view mode: check View > View Mode -> Radialmap View.

Filelight represents your disk as a circle, and each directory has an arc proportional to the space it's using. Colors help differentiate the directories. Subdirectories appear at an outer level, in concentric rings, but if a directory has too many files, a black triangle will appear instead. Hovering the mouse over an arc sector produces a popup that shows the full path of the corresponding directory, its size (both in megabytes and as a percent of the total space), and the number of files in it. Clicking on a sector works recursively; the selected directory becomes the circle, and you can see more detail. Right-click on a sector for a context menu that lets you delete a directory or file.

Filelight takes few configuration parameters, but you can select the colors that will be used, whether small files should or not be shown, and some similar appearance details. You can also specify that some directories (such as /sys or /proc) shouldn't be scanned.

Philesight is a clone of Filelight written in Ruby and designed to work through the Web. You need a CGI-enabled server in order to run Philesight; check the installation instructions and requirements on the program Web site. You can click on directories to expand them, and because it's Web-based, you can remotely check the free space on a host, but you will need other tools to fix the situation if not enough space is free.

JDiskReport is also similar to Filelight, with the added advantage that it can work in other operating systems too, since it's written in Java. Installation is easy; just download the zip package with the latest version, unzip it, and run java -jar jdiskreport-1.3.1.jar (for the current version). The first time you run the program it will ask you to accept its license, then ask you which directory to process, and scan it. Some directories (such as /proc) are automatically excluded; go to File -> Preferences -> Filter to see which others are.

JDiskReport shows the directory you analyze as a pie chart, including the largest subdirectories as individual slices, and an Other slice for all the smaller slices together. This is a problem, because you have no way of opening and studying the files that compose that slice. If you want to see more slices (so fewer files will get lumped together in Other) go to File -> Preferences -> Charting and fiddle with the parameters there.

Clicking on a slice drills down, showing a new pie chart for just the clicked directory. The complete directory is shown at the left in tree format, and you can click on any directory there in order to show it by itself. Alternatively, you can click on the small "view" icons at the bottom, and get a ring chart (similar to Filelight's), a bar chart, or merely a list of files. A checkbox allows you to show or hide individual files; directories are always shown.

JDiskReport has some other functions. The Top 50 tab shows the 50 largest (or oldest, or newest) files. The Size Dist, Modified, and Type tabs show histograms by size, date, or file type, which are informative though not quite useful. The icons on the toolbar allow you to navigate around a directory, rescan it, or sort the results in different ways. You cannot delete files directly from JDiskReport, and this is a bother; after you decide what files to delete, you have to use a separate tool to free space.

While the foregoing programs all represent disk space with circles, KDirStat uses rectangles and squares to show the occupied space, applying the treemapping technique. The whole directory is represented by a rectangle, and its subdirectories are in turn represented by smaller rectangles and squares, within the bounds of the original rectangle, making it easy to detect the larger files at a glance.

While KDirStat is a KDE program, it runs in other desktop environments, and there's even a Windows clone called WinDirStat. Installation should be trivial, since it is included within most distributions. When you run it, it asks which directory should be processed, and then starts reading them all, while a Pacman-like figure walks onscreen. (You can change that from Settings -> Configure -> General.) After the map is created, you can click on any rectangle to get information on it, and you can also send it to the Trash or delete it permanently. You can also define other actions; go to Configure -> General > Cleanups and you will find several predefined options, with space for your own.

FSView is a plugin for Konqueror that provides a similar view: navigate to any directory, select View -> View Mode -> File Size View, and you will get a treemap showing the selected directory. Clicking on a square allows you to see its treemap, and you can delete files to free space.

Baobab (now called Disk Usage Analyzer) has two alternate styles: a simple listing with percentage bars, or a treemap view. However, it uses an ugly algorithm that allows for skinny rectangles, making navigation difficult. Hovering the mouse over a directory rectangle shows a tooltip with the folder name, and by right-clicking and selecting Open you can open a file manager and delete files there. You can specify which devices should be included in a general filesystem scan.

In Linux there usually are several options for solving any specific problem; for analyzing disk space, there are at least a dozen different ways you can go about it.


  • Tools & Utilities
  • System Administration
Click Here!