Main Content

Finding where the disc space has gone

Archive - Originally posted on "The Horse's Mouth" - 2006-02-06 18:37:48 - Graham Ellis

Murphy's fourth law states that data expands to fill the disc space available, and there's a collaboration that states that it reaches that full point when you're trying to save a file you should have saved a long time ago during a complex operation.

I'm not a good one at deleting old backup files; I tend to have directories marked "january 06" and things like that; in that way I can go back to "when" and find old stuff. I want to know about the Geek cruise? Why - those notes are in October '04. Not sure of a date? A background grep can find stuff for me. So I've been running at 90% full for a while. Applications have been starting to grumble a little, and were starting to get a little bit more upset over the last day or two. Not helped by a mailbox that's getting hit by a fair flow of spams / viruses of about 179k each that get put in the trash quickly enough, but then stay there until the dustman commeth.

I'm on an OS X box. These same commands work for Linux and Solaris too:

df -k How full are my discs?

du -sk How big is the current directory and everything below it?

du -k How big is the current directory tree, directory by directory

du -sk * How big is EACH entity in the current directory? Really Useful!

It was using a du -sk * on my home directory that brought me, a few minutes ago, to an aptly named directory called "huge" of some 18Gbytes. A 2Gb copy of the entire DMOZ database, plus a 6 Gyte file that contained the entire thing replicated 3 times over, and a further copy of that 6Gbyte file chunked up into units of just 1Gbyte. The result of some well remembered, logged, important work on how Python can handle huge files, but some temporary data that was able to release 15% of my disc space with a single rm.