There are a number of ways virtual desktops can be deployed within vWorkspace, these days however the most common way is to use vWorkspace InstantPrep and Hypercache. When using these methods and vWorkspace features we do a number of things, one of which is to make use of hyper-v differencing VHD disks. A differencing disk is also known as a child disk and stores the changed/modified data of the parent disk. This allows us to use considerably less disk space and speeds up provisioning times for virtual desktops and RDSH servers. Furthermore the vWorkspace Hypercache dramatically reduces IOPS requirements. More information on these can be found here:
The main reason for writing this post is that we recently noticed a subtle change in the default settings of a .vhd and .vhdx which is the newer virtual hard disk format. This change was in the block size of the virtual hard disk which increased in size from 2MB with a .vhd to 32MB with a .vhdx. This has a dramatic effect on growth of the disk, so customers would see rapid growth of their deployed virtual desktops in a short period of time as well as a reduction in the performance.
Whilst working with a customer recently they raised a concern that their deployed virtual desktops were quickly growing to 10GB each and rising to 13GB when a user was logged in. This severely limited the scalability and number of virtual desktops they could provision which would have increased the over all project costs. It is difficult to say exactly what the size should be, but from my experience a newly deployed virtual desktop will start off at approximately 1GB in size and should not really grow any bigger than 3.5GB (approximate) when it is in use.
So with all this in mind I thought it would be useful to create a checklist of recommendations to ensure your templates are configured to best practice:
Ensure recommended block size (2MB) in the virtual hard disk.
Use Dynamically expanding vhd.
Run the vWorkspace template optimizer. More information can be found here Quest vWorkspace 7.5 Feature Spotlight: Desktop Optimizer
Ensure you have the Advanced Storage Optimizations enabled.
1) Ensuring the recommended 2MB virtual disk block size
Setting the correct VHD block size on a new template
If you have found this article before creating your template within vWorkspace and you are using Hyper-v 2012 or 2012R2 then please consider these steps:
Below is a video showing how to create a template virtual machine with the recommended settings. The video shows how to create a virtual machine with a .vhd and a .vhdx virtual hard disk.
Checking the VHD Block Size
If you are using Hyper-v 2008 R2 or more specifically a .vhd then it’s a safe bet that you already have the 2MB block size. Likewise if you are using a template which was created before you deployed Hyper-v 2012 then again it’s a safe bet that you already have the block size of 2MB. If you want to check it’s very simple. Login to your 2012 hyper-v server and open a Powershell Window and use the Get-VHD command, example below:
get-vhd "C:\VirtualMachines\Win7 x86\win7entx86_dv2.vhdx"
The screen shot below shows and example of the results:
Then check that the BlockSize is 2MB or 2097152 bytes.
Changing the VHD Block Size
When importing a new template into vWorkspace if we detect that it’s of a vhdx format a warning pops up, which also provides some useful Powershell commands.
Here are the commands for you convenience.
New-VHD -Path C:\VirtualMachines\MyTemplate\MyTemplateOS.vhdx -Dynamic -SizeBytes 50GB -LogicalSectorSizeBytes 512 -PhysicalSectorSizeBytes 4096 -BlockSizeBytes 2MB
Convert-VHD -Path "C:\VirtualMachines\W2012\Virtual Hard Disks\W2012.vhdx" -DestinationPath "C:\VirtualMachines\W2012\Virtual Hard Disks\W2012-2.vhdx" -BlockSizeBytes 2MB
2) Use Dynamically expanding vhd
If you have followed the guide above when creating a new virtual machine for your template and you selected to create and add the virtual hard disk later, one other recommendation is to use a dynamically expanding virtual hard disk.
Doing this will not save any time when deploying new virtual desktops because when using vWorkspace HyperDeploy we start powering on virtual machine long before the parent virtual hard disk has finished copying. Using dynamically expanding virtual hard disk will reduce the storage requirements on the template volumes.
3) Run the vWorkspace Template Optimizer
More information on the template optimizer can be found here: The FREE Quest vWorkspace Desktop Optimizer The template optimizer will really improve the performance of your virtual desktops as it will reduce read and write I/O by up to 90%, reduce memory utilization and reduce CPU overhead.
4) Ensure you have you have Advanced Storage Optimizations enabled
In Dell vWorkspace 8.0 we enhanced HyperDeploy so that it now optimizes the way that a virtual desktop is stored on the host. By doing this we are able to save significant amounts of disk space (roughly the amount of RAM that the virtual machine is using). This should be enabled but a few times i have found it not to be for one reason or another, so to ensure you have this enabled do the following:
Excellent blog... just wondering, can I do the disk alignment after installing the OS?
yes you can use the convert PowerShell command even after installing the OS
Thanks Paul for your reply, will do that and update you..
Unfortunately, presented with an error the path already contains vhdx file...
PS C:\> Convert-VHD -Path "C:\ClusterStorage\HV-VDI\v-Win10-Template\v-Win10-Template\Virtual Hard Disks\v-Win10-Templat
e.vhdx" -DestinationPath "C:\ClusterStorage\HV-VDI\v-Win10-Template\v-Win10-Template\Virtual Hard Disks\v-Win10-Template
.vhdx" -BlockSizeBytes 2MB
Convert-VHD : Failed to convert the virtual disk.
The system failed to convert 'C:\ClusterStorage\HV-VDI\v-Win10-Template\v-Win10-Template\Virtual Hard
Disks\v-Win10-Template.vhdx': The file exists. (0x80070050).
At line:1 char:1
Got it.. The procedure is;
1. Turn off the VM.
2. Create new Folder in the Cluster Storage Path / Or any other path.
3. Run the Command to convert the vhd to 32bit blocksize. (Convert-VHD -Path ("Path") -DestinationPath ("Path") -BlockSizeBytes 2MB
The new file will be created depends on the disk size, in my case since its new VM with only 8.9GB used space it took less than 3 minutes to create the new file with 2MB blocksize.
4. Change the hard disk of the VM from the old vhdx to the newly created vhdx.
Boot your VM, and you are good to go.
Hi once again,
Is there a special vWorkspace desktop optimizer for Windows 10?
Windows 10 is experimental support at the moment. The current desktop optimizer should run ok however.
Does this applies to VMwre VM?
No this is only for Hyper-v.