Expanding a Citrix Provisioning Service vDisk with Hyper-V
One of the advantages of virtualization is the ease of resource allocation. Whether it’s adding additional memory or increasing available hard drive space in a Virtual Machine, it’s usually just a few clicks away and does not require any screwdrivers.
My colleague Jacques Bensimon sent over some handy directions (plus bonus tip!) for expanding a VHD using Hyper-V. In his case, the VHD was a Citrix Provisioning vDisk.
1. Copy the PVS vDisk (let’s call it CitrixPVS.vhd) to the Hyper-V machine.
2. Without having to assign CitrixPVS.vhd to any Hyper-V VM, just right-click any existing VM and select Edit Disk… This takes you to the “Edit Virtual Hard Disk Wizard” which lets you select any VHD (not just VHDs belonging to the VM you right-clicked). Select CitrixPVS.vhd from wherever you saved it, select the Expand option, and make it any new size you want. The VHD file has now been expanded to the desired size, but of course the internal volume is still the original size.
3. Now go to the Windows 2008 R2 server’s “Server Manager”, go to Storage | Disk Management, right-click, select “Attach VHD” and attach CitrixPVS.vhd. Once it’s attached, use the “Extend volume…” option to make the partition within the VHD use all the new space.
4. BONUS: At this point you’re done, but as long as you have the VHD attached in Disk Management, don’t detach it right away and use (for example) the free Piriform 64-bit Defraggler to defrag the volume (when was the last time you defragged a PVS vDisk?!). Then detach it and you’re really done!
Note that this procedure never actually boots the vDisk and operates on it by strictly external means.
If you don’t have a Hyper-V server handy, you can check out the non-Hyper-V way.