20 September 2010

Expanding hard drives and partitions by using dynamic disks and volumes

Virtual environments are great because they give you the ability to allocated actual hardware resources in a dynamic manner to your virtual machines.  Sure there are a few restrictions, mostly that the machines needs to be shut down, and in the case of disk that there can be no snapshots or checkpoints.

Virtual drives in Hyper-V can be allocated as either Dynamic or Fixed.  This is the same for Vmware.



The difference is that where a Fixed disk grabs the full allocated space on the host or shared storage, the Dynamic disk only grabs as much as it needs.  The advantage is that you are only consuming as much disk as you need.  There is a small performance penalty as the disk has to expand, but not the sort of thing that would worry a development or test server.  Just a note here as well, disks will expand or grow automatically but they will not shrink or compress automatically.  You can manually perform these actions of you want to.


This brings me to the second part of this article.  Typically the only time you would want to mess with a dynamic disk is when you run our of disk space within the virtual machine.  At this point you can add another disk or you can make the hard drive bigger by expanding the disk.  This will expand the disk for the virtual machines so you would end up with this picture.


There is now disk space available to the OS but it cant be used unless it is allocated to a partition and logical drive.  Previously this would be a bit of a problem since you could not in any practical manner expand the OS partition.  This is where one or my Windows Server 2008 favourite tricks come in. Right click the active partition. and click Extend Volume.



A Simple wizard will guide you through the process. and provide the options that you might want to change.  You might for instance not want to grow the volume to all the available space. 


You might be wondering why you would not do this if you are using a dynamic disk.  A real world example would be where you want to limit the disk space being used by someone,  if they make use of snapshots this creates a problem if you need to give them more space.  It is far easier to just expand the volume into unallocated space than to have to expand the virtual disk first.

Once you have completed the wizard your Virtual machine and OS can now make you of the added disk space. 


Just a little reminder.  Since this is a setting that resides within the virtual machine it is something that would be reverted if you restore a snapshot that predates expanding the volume.

No comments:

Post a Comment