Wednesday, April 12, 2006

Recovering space on a sparseimage file

If you’re like me and use sparseimage files for backing up your hard drive, you’ll notice that the disk can expand and shrink. But the cost is that, while the content on the image shrinks, the sparseimage file itself doesn’t, and you’re left with an ever-expanding image file.

The solution is to use hdiutil compact in the Terminal to reclaim the empty space:

localuser$ hdiutil compact /Volumes/HardDiskName/DiskFileName.sparseimage

Better yet, set up a script that runs as a cron job to do this automatically for you periodically!

No comments: