This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Tools & Utilities

Where has my disk space gone?

By Federico Kereki on December 17, 2008 (2:00:00 PM)

Share    Print    Comments   

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.

Federico Kereki is an Uruguayan systems engineer with more than 20 years' experience developing systems, doing consulting work, and teaching at universities.

Share    Print    Comments   

Comments

on Where has my disk space gone?

Note: Comments are owned by the poster. We are not responsible for their content.

Where has my disk space gone?

Posted by: Anonymous [ip: 60.242.38.36] on December 17, 2008 02:48 PM
New versions of Baobab have a ring view too. Make sure your using the one included with 'gnome-utils' not the stand alone 'baobab', although I think the standalone one now supports it (although it will depend on what your distro has).

http://www.marzocca.net/linux/baobab/baobab-ringschart.html

#

Where has my disk space gone?

Posted by: Anonymous [ip: 79.113.86.22] on December 17, 2008 02:57 PM
ncdu is another way to display diskspace useage in CLI. Ncurses-based.

#

Re: Where has my disk space gone?

Posted by: Anonymous [ip: 67.88.249.34] on December 17, 2008 06:43 PM
I have been looking for a shell tool to do this.

THANKS its running right now. Note it's in Ubuntu but only in Debian testing (which might go live at any point in time now or could be 6 months)

#

Where has my disk space gone?

Posted by: Anonymous [ip: 216.16.231.150] on December 17, 2008 04:01 PM
For the minimalists out there: xdiskusage
http://xdiskusage.sourceforge.net
All you need is X.

#

Where has my disk space gone?

Posted by: Anonymous [ip: 141.24.43.121] on December 17, 2008 04:35 PM
No comment about durep? A really nice command line tool to view disk utilization.

#

Re: Where has my disk space gone?

Posted by: Anonymous [ip: 67.88.249.34] on December 17, 2008 06:49 PM
And Thank you. durep is now checking on my debian box, ncdu was not available yet from the comment above. Servers (especially backup servers) run out of space and it's nice to have an easy tool to check a bunch of directories, du rocks but this is even easier.

#

Where has my disk space gone?

Posted by: ForLinux on December 17, 2008 04:40 PM
[url=http://url]URL text[/url]

#

Where has my disk space gone?

Posted by: Anonymous [ip: 66.240.11.2] on December 17, 2008 08:13 PM
du is another CLI tool that's really good at showing you where space is going.

$ cd /home
$ sudo du -s -m -c *
1 user1
47 user2
1 user3
1 user4
1 user5
1 user6
1 user7
1 user8
3 user9
50 total

The only gotcha would be if you show sizes in 1MB chunks like this, it rounds up to nearest megabyte, so the total may not add up to the original rounded values. The total is arrived at then rounded.

#

Re: Where has my disk space gone?

Posted by: Anonymous [ip: 24.174.64.232] on December 19, 2008 08:20 AM
du -h * | grep -v /
dunno if that works for GNU utils, works like a charm in Solaris

#

Where has my disk space gone?

Posted by: Anonymous [ip: 68.63.108.124] on December 17, 2008 08:26 PM
WinDirStat is a clone of KDirStat? I love WinDirStat, thanks for pointing out I don't have to put up with baobob any longer!

#

Where has my disk space gone?

Posted by: Anonymous [ip: 69.209.51.46] on December 17, 2008 08:52 PM
In order to get the size of all the subdirectories and files in the current directory run:

$ du -sh `ls`

#

Where has my disk space gone?

Posted by: Anonymous [ip: 79.65.178.109] on December 17, 2008 09:35 PM
gt5 is a useful console disk usage tool, something like ncdu but also shows the difference since the previous run. It's in Debian Lenny, don't know about other distros or OS.

#

Where has my disk space gone?

Posted by: Anonymous [ip: 68.107.136.238] on December 17, 2008 10:15 PM
Another great one, which I use, is gdmap: http://gdmap.sourceforge.net/

(Also: " du -sh `ls` " is no good because it will not handle any filenames with spaces. Use " du -sh * " instead.

#

Where has my disk space gone?

Posted by: Anonymous [ip: 190.17.101.83] on December 18, 2008 01:52 AM
don't forget scanner 2.0

http://www.freedownloadscenter.com/Utilities/Disk_Analysis_Utilities/Scanner.html

it's fileligh for windows, and it works great!!!

#

Where has my disk space gone?

Posted by: Anonymous [ip: 76.199.5.101] on December 18, 2008 09:17 PM
use grand perspective for mac, its light and clean and really well designed

#

Where has my disk space gone?

Posted by: Anonymous [ip: 59.164.19.20] on December 18, 2008 09:47 PM
"kdf" for quick free space info (no details)
Konqueror's File Size View is da best evah...!
FileLight is sexy but for the math / tech / science types, IMO.

#

Re: Where has my disk space gone?

Posted by: Anonymous [ip: 190.135.37.46] on December 18, 2008 10:38 PM
kdf = kDiskFree

#

Where has my disk space gone?

Posted by: Anonymous [ip: 92.227.16.194] on December 19, 2008 02:14 AM
I am totally for Konqueror's File Size View.

It looks like this, and has lots of options like depth of directories to analyze, horizontal or vertical labeling etc.

http://www.ninja-assassins.com/linux/screenshots/konqueror-filesize-view.png

#

Where has my disk space gone?

Posted by: Anonymous [ip: 209.125.235.182] on December 19, 2008 06:25 AM
If you want a KDirStat for OS X, look for Disk Inventory X. I don't know if it's a copycat or a port but it gives a similar report.

#

Where has my disk space gone?

Posted by: Anonymous [ip: 72.59.245.62] on December 19, 2008 02:58 PM
Pydirstat is great. It generates various types of output (but I always prefer HTML), and can be used wherever python is available (which works on any OS). Works from the command-line, so you can even use it via SSH--that is, you can use it on remote machines, not just local Desktop environments. It is a sysadmin's sweetheart tool.

http://pydirstat.berlios.de/

#

Where has my disk space gone?

Posted by: Rubberman on December 19, 2008 07:54 PM
Remember that old variation on Parkinson's Law: data expands to fill existing disc space + 10%. It doesn't matter how much space you have, or add to your system, you will always need that extra 10%... :-)

[Modified by: Rubberman on December 19, 2008 07:55 PM]

#

Installing Philesight

Posted by: Anonymous [ip: 69.76.204.209] on January 03, 2009 09:09 AM
When I saw this article, I knew I had to have philesight for a project I was working on. I was dismally disappointed to see that the author basically never thought about the RHEL world. His site makes it look really complicated to install on RHEL. However, even though he didn't package it for RHEL, it is trivially easy to install it on RHEL based distros. Here are two copy-and-paste install scripts. One for Fedora 10, and one for CentOS 5.2.

Fedora 10:
yum -y update
yum -y install ruby ruby-cairo ruby-bdb
wget http://zevv.nl/play/code/philesight/philesight-20081120.tgz
tar xf philesight-20081120.tgz
cd philesight-20081120
./philesight --db db.temp --index /tmp
./philesight --db db.temp --path /tmp --draw asdf.png

CentOS 5.2:
yum -y update
cd /etc/yum.repos.d/
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
wget http://ruby.gfd-dennou.org/products/rpm/RPMS/CentOS/CentOS-DennouRuby.repo
yum -y --enablerepo=kbs-CentOS-Testing install ruby bitmap-fonts ruby-bdb ruby-cairo
cd
wget http://zevv.nl/play/code/philesight/philesight-20081120.tgz
tar xf philesight-20081120.tgz
cd philesight-20081120
./philesight --db db.temp --index /tmp
./philesight --db db.temp --path /tmp --draw asdf.png

That's it! Installed and tested, in one paste! Good luck, and enjoy the software!

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya