One of the first things you do when configuring a new Virtual Machine is to define the storage resources that it will be using. Mostly, this is because even the most basic of VM’s will need someplace to put the Operating System files, and that place is a virtual disk or pass-through to a physical disk.
Alright, you have the requirements for your disks, and you want to use virtual storage (VMDK for VMware, VHD for Hyper-V, etc.) to house all files and data for this VM. Now you get faced with the decision of what kind of VM disk you want to use. There are two common choices, thin or thick provisioning for the data and systems volumes.
So what do those choices mean?
Thick provisioning (sometimes called static disk or fixed-size disk) is the idea of allocating all the space that the disk can take up immediately. So if you tell the system to create three 50GB thick-provisioned disks, you will see 3 VMDK or VHD files, each using 50GB of space get created. You can typically re-size the disks later, but this is a manual process.
Thin (or dynamic, or expanding) disks allocate space only when necessary, and automatically. They typically start out with a few hundred MB of space, but are capable of growing up to whatever limit you set on them as required.
So why would you choose one over the other?
Thick provisioned disks allow you to explicitly allocate storage to machines where you know that you’ll need X amount of space most of the time. In earlier versions of hypervisor tools, they also offered better performance because the hypervisor didn’t need to dynamically track each volume and expand it over time. However, most of the performance issues are no longer present, so the choice to use fixed-size volumes is more about simply knowing for certain that a particular amount of space is necessary.
But, what if you’re not sure how fast a group of five servers will grow, but you do know that only two of them will grow at all – just not which two. You don’t want to allocate all the space for all the volumes when you know that three servers won’t ever need that much space. It’s a waste of (potentially expensive) disk space. That’s where thin provisioning comes in.
Think of a thin-provisioned disk as a water ballon. It starts off as a very deflated balloon with just a tiny bit of air in it to get it started. Then, as water (data) is poured into the ballon, it swells up to the maximum size over time. You don’t have to do anything to get the balloon to grow except add more water – in much the same way as adding data to a thin disk makes its size increase.
If you have just the one water balloon, the only problem you have is trying to put in more water than it can hold at maximum. Stay below that much water, and you can add and remove water whenever you want. Thin disks are limited by the maximum amount of space you declare they can use, but can grow and shrink within those limits as necessary.
Now, back to our five server scenario. Let’s say you had five balloons in a rigid box that could only allow any two of them to grow to full size. So long as only two get that level of water, you’re fine. If a third tries to grow too big, all the balloons pop and leave you with a major mess.
In thin provisioned disks, the rigid box is the total amount of physical disk you have to work with. So as long as not all five VM’s try to use up their full allocated space, you’re fine. Have too many disks use up too much space, and boom.
For our scenario, I know that only two will ever grow to their full capacity, I’m just not sure which two it’ll be. So I put all five VM’s in the same balloon box and watch them, making sure only two fill up.
That is – of course – a gross oversimplification of how thing provisioned disk works, but you get the general idea. Each disk uses up only the space they need, and can grow within the limits of the physical disk allocated to the group of VM’s. If too many disks grow too quickly, you have to jump in and move some VM’s to other storage systems to avoid running out of room to allocate space.
The good news is that most modern hypervisors have ways to move either the storage or the entire VM with minimal downtime in these scenarios. Some can even do it automatically based on the overall load of the storage attached to each VM host.
Thin provisioning can help you avoid wasting disk, and can be a great part of an overall virtualization strategy for most organizations. Just keep in mind that you have to watch thin provisioned systems a bit more carefully than their thick provisioned brothers and sisters, and you’ll master the use of disk space in no time flat.