Oddities with disk space calculations

Local Snapshots

In OS X 10.7 Lion Apple introduced local snapshots. While being useful in general, these snapshots can take a significant amount of disk space which Finder doesn’t take into account. DaisyDisk, in contrary, reports disk usage data without cheating.

Do not worry about disk space, it’s recoverable. Just connect your Mac to the Time Machine Volume or ignore the snapshots: they won’t fill up your whole disk.

HFS+ Compression

DaisyDisk reports files and folders packed using HFS+ compression by their actual size. On the other hand, Finder returns file sizes as if they haven’t been compressed. DaisyDisk’s values are more accurate for determining files which actually use more disk space.

Compressed files may take significantly more disk space when copied to another location as in this case compression will be omitted.

Disk images

When working with disk images it’s good to keep in mind that they are basically just containers for data. They can be solid files with fixed size (for example, ISO images), compressed files (like large ZIP files) or even bundles (sets of smaller files virtually appearing as single objects) in case of sparse bundles.

When mounted, each disk image reports three values: capacity, used space and free space, just like a real disk. The problem is that these figures are virtual and sometimes may be misleading (no, this is not how DaisyDisk works, that’s the data Mac OS X provides).

For fixed-size images, the capacity matches the actual amount of space taken by the image on disk. The free space and used space indicate the amount of data that the disk image can contain, but the actual size of the disk image remains the same even if it’s completely empty.

Things get even more interesting with sparse images and sparse bundles. Unlike the fixed-size images, whose size is, well, fixed, sparse images can be initially small and expand when necessary. The virtual capacity of sparse images can even exceed the size of the storage device where the image is located. The virtual free space figure, in its turn, is limited by the system to the amount of real free space on the storage device. That’s where the weird things begin. The used space figure is calculated as the difference between the capacity and free space values. Consequently, when the virtual capacity of the disk image exceeds the real free space on the storage device, you may see strange used space figures that have nothing to do with the size of data actually located on the disk image.

Keep in mind, that sparse images can only grow and never shrink automatically. In other words, deleting files from a sparse image in attempt to reduce its size won’t work. You’ll have to compact the image using hdiutil compact console command.

Network and virtual disks

Some network and virtual disks may also misreport more free space or higher capacity than they actually have. Unfortunately, there’s hardly anything we can do about it, as the same figures are presented by the Finder.

Disk space preallocation options on certain network setups may also result in misleading scan reports.