Thursday, March 21, 2013

Recovering MacOS X Disk Space with GrandPerspective

There aren't very many Mac utility programs I find useful on a regular basis, but GrandPerspective is one of them.
On UNIX-derived systems it can be painful and tedious to figure out where your disk space is going. Some versions of MacOS X have had bugs that allowed log files to pile up in huge numbers; some applications have bugs that allow huge temp files to accumulate. If you're a regular UNIX command-line user you probably know how to use *du* to find big disk usage hot spots, but it's not suitable for everyone.
On a couple of occasions I have used GrandPerspective to figure out where a system's disk space was actually going, and the results can be very surprising. Here is a GrandPerspective screen shot showing my system volume:


On the right, the black area represents empty space on the volume. So it isn't near to full, but I have noticed the space used has been growing dramatically recently. With GrandPerspective you can just hover the mouse over the highlighted areas and see what files the colored areas represent. Just because a file or a group of files occupy a lot of space doesn't mean I want to get rid of them. I'm more interested in finding unexpected disk usage. So there on the lower left section, flush against the left edge of the window, that square of mostly regular-looking pale yellow blocks next to the rectangle of pale orange blocks? Those are Apple Loops -- installed with Logic Pro. I use those sometimes, and that set of files isn't growing, so I'm not interested in removing them. What about the big red blocks in the upper middle? Those are mostly disk images -- for example, Linux distribution ISO files, .dmg files for purchased software I've downloaded, and backup disk image files from Apple system software. I might want to clean out some obsolete or unused files but again, it's not really what I'm looking for. But what's that set of _huge_ orange files in the upper right?
It turns out those correspond to this directory:

Wow, the largest of those files are over seven gigabytes each! I use Izotope RX weekly (or so) do do noise-reduction on audio files I record for podcast production. Apparently the application is piling up enormous temp files and never cleaning up after itself. So those can all go -- everything in that folder with the suffix ".tmp." Oddly, some of them are zero-length files. Clearly, RX could use some improvement here. This cleanup immediately recovered over 60 GiB of disk space! Let's take a look at the image after re-scanning:
Browsing around is an interesting exercise: I can see that a good chunk of my system hard drive is being taken up by Garage Band content, the Applications folder, and other stuff that is bulky but that I probably don't want to delete. Roughly the entire lower right quadrant is my iPhoto library. That's big, but it represents many years of pictures, and it is not growing unexpectedly. There are some movie files in iDVD projects I might consider relocating, and other stuff, but nothing that surprising. But what is going on with that block or orange squares in the upper right? That stuff apparently lives in /private/var/folders/3s/wrzn0f7r8xj3h7001s60qgjr0000gn/T. It includes a whole slew of pairs of files files with names like A9RI9eiM4.pdf and WebKitPluginStreamM9aMQG_AdobeTmp -- both those files are 799.7 megabytes in size! What are they? It appears that the PDF files are files that I viewed online -- in this case, a bunch of full scans of old issues of Byte magazine that I was looking at on archive.org. My web browser crashed while looking at these files. However, stuff in these temp directories is generally thrown out after a reboot, so I shouldn't need to delete them manually. Indeed, after a reboot, I can confirm that these files are gone.

You can find this great tool, GrandPerspective, here.

No comments: