The power of COWs
First, a primer on COW ( Copy on Write ) disks:When you create a virtual disk in VMware ESX, chances are that it is what is known as a 'monolithic' virtual disk. That is, for each byte of data that can exist inside a virtual machines hard drive there is a byte of data that is reserved on the physical drive and/or LUN. A COW disk on the other hand only occupies as much space on the physical hard drive as the is space occupied inside of the virtual machines hard disk. For example, if I had a Windows XP VM with a 20GiB virtual hard drive and 15GiB of free space inside the VM the COW disk would occupy 5GiB of disk space on the physical hard drive. Here is the syntax for creating both a 'thin' ( COW ) disk and a 'thick' ( Monolithic ) disk. Also, I've added the output of 'du -hs' which displays the actual file sizes for these virtual drives. Note that the COW disk at this point only occupies 1M and the monolithic disk has been allocated all 20GiB.
[root@esx01 esx01-storage2]# vmkfstools -c 20G -d thin cow.vmdk
[root@esx01 esx01-storage2]# vmkfstools -c 20G -d thick monolithic.vmdk
[root@esx01 esx01-storage2]# du -hs *
1.0M cow-flat.vmdk
64K cow.vmdk
20G monolithic-flat.vmdk
64K monolithic.vmdk
It's little known fact that VMware ESX can in fact make use of COW (Copy on Write) disks. It's little known because this functionality isn't exposed through the virtual infrastructure client, and for good reason. It's hard to effectively plan how much space your VMs will need in the future and it's very easy to get into trouble if you get into a situation where you have multiple VMs competing for the same physical drive space.
One particularly good use for COW disks is templates. Templates are generally full of free space, and they're also powered off nearly 100% of the time which gives them little chance to grow and cause problems. Even nicer is that when you deploy a template from a COW disk the deployed VM is automatically converted to a monolithic disk. Should you ever need to copy a template to a remote site it will take less time because the size on disk is also reduced. The only drawback is that you must create the virtual COW disk from the command line ( for now ).
Labels: monolithic cow template
Archives
10/01/2006 - 11/01/2006 | 03/01/2007 - 04/01/2007 | 04/01/2007 - 05/01/2007 | 05/01/2007 - 06/01/2007 | 06/01/2007 - 07/01/2007 | 07/01/2007 - 08/01/2007 | 09/01/2007 - 10/01/2007 | 10/01/2007 - 11/01/2007 | 11/01/2007 - 12/01/2007 | 12/01/2007 - 01/01/2008 | 01/01/2008 - 02/01/2008 | 02/01/2008 - 03/01/2008 | 03/01/2008 - 04/01/2008 |