VMware Fusion 201: Sparse Virtual Disks

If you’re new to virtualization and computers, you might be confused about why deleting a virtual machine doesn’t seem to free up the space you think it should, or why the guest might be complaining it’s out of space when there’s plenty left on the host (or vice versa). Why this happens becomes clearer when you start thinking in layers.

Before we begin, one common misconception is that Fusion somehow partitions the physical drive – not so! For normal virtual machines, a virtual disk is simply a (probably pretty large) file. We use normal OS X file operations to access it. For Boot Camp virtual machines, there is partitioning of the physical drive involved, but Fusion doesn’t do it – you did it when you set up the Boot Camp partition in the first place. While we do use raw disk access for Boot Camp virtual machines, again, it’s by standard OS X APIs.

By default, VMware Fusion uses what are called "sparse" disks. That is, we don’t grab space upfront, but rather as needed. In the diagram, chunks of space (for technical users, blocks) are represented as squares; colored ones are occupied, white ones are unused. The guest (green) thinks it has an entire 20 GB (or whatever) drive. However, if the guest has only ever written 5 GB to the drive, the .vmdk file (red) will only be 5 GB, not 20. The host (blue) can store the .vmdk however it wants on the actual hard drive, perhaps interspersed with other files (grey).

Since Fusion doesn’t grab space upfront, deleting a virtual machine with a 20 GB disk might not (actually, probably will not) free up exactly 20 GB of space. It can be less (as in this example) or more (if you have a snapshot, which I’ll cover in a later post). There are other files in a virtual machine, but the virtual disk is usually most of it.

Each layer is (at least somewhat) separated from the others, which can lead to some misunderstandings. For example, if you run out of space in the host, it doesn’t matter if you still have 10 GB left in the guest – there’s simply nowhere to put the data. Conversely, even if you have 100 GB left on the host, if the guest has used up the entire (virtual) hard disk, it can’t write any more data. Keep an eye on free space in both the host and the guest.

The main advantage of using sparse virtual disks is, well, that they take up less space. As always, there’s a tradeoff involved, but we think the benefits for most people outweigh the inconveniences. In the next VMware Fusion 201 post I’ll talk about your other option, preallocated virtual disks.


Leave a Reply

Your email address will not be published.