Friday, December 16, 2011

Provisioning Server (PVS) Cache on device issues

I recently ran into some issues streaming VMs and taking advantage of the local storage on the hypervisors for the local cache.

Many of these issues were due to my lack of experience with the product, so I am making notes here for future use.

First, if you are not familiar with Provisioning Server or have not taken a look at it for a few revisions, go download the latest version.  There have been a lot of improvements since the last time I looked at it (a few years ago). 

Cache on Device Hard Drive is actually from the PVS feature to stream to bare metal.  In the VM world it allows me to use local storage that is relatively inexpensive (unless you use SSDs – but hey, just another possibility) and just fine when you don’t want to persist the cache disk.

Okay, enough of that, back to my cache disk issue notes.
Firstly, when you create your Template VM, be sure to create the local cache disk as its local drive.

Secondly, don’t forget to format this disk for your streamed OS.  So, for Windows, format it NTFS (I am just booting the VM that will be my template to WinPE and using DiskPart to avoid ACLs.)
Third, make that cache disk large enough.  This was my most perplexing puzzle and I fiddled for a couple days with this off and on.

When I booted the VM and login I would get this strange error message:  “Windows created a temporary paging file on your computer”

This issue is specific to using the Cache on Device setting when your vDisk is set to shared mode.  The root is that the default page file location cannot be written to as it is the shared vDisk image.  The ancillary detail is that the page file gets moved to the device cache disk which is some drive other than %system%.

So, I had my local cache, all formatted, as small as it thought it needed to be.  I booted my vDisk and the error.  I set the vDisk to private mode and fiddled around with paging file settings.  I went back to my template VM, booted in shared mode, no paging file. 

I searched and found all kinds of related errors; moving it off C:, using a SCSI attached VHD instead of IDE (I happen to be using XenServer so this was not it), ACLs on files within the VHD, also obscure errors where the programs are expecting specific folders to exist on the cache disk.  All of these are totally valid errors and entirely possible in their scenario, just not mine.

Very frustrating.  It was when I booted with the VM template in private mode with the cache disk attached and I attempted to move the page file that I got a useful error:  the destination is not large enough.

Duh!  My device cache disk (the virtual disk of the VM) was not large enough for the caching of temporary files AND the page file of the VM operating system.  So silly.

I went back and recreated my template VM, with a larger cache disk – taking into account any dynamic memory settings.

Once I made this larger VHD (formatted with Diskpart) and booted using private image mode with cache on device hard drive all was good.


Anonymous said...

I realize this is an older article, but I just wanted to acknowledge the wisdom and assistance provided. Similar symptoms have been driving me crazy over the last month or so. In short, provisioned machines created via the XenDesktop Setup Wizard in PVS ver 6.1 (to XD 5.6 farm on XenServer 5.6), using a “shell” template with a second drive attached (for WriteCache) would not “cache on device hard drive” when vDisk properties were set accordingly. Cached files would be written back to the PVS server (cached on server).
After also finding and implementing the “related errors” listed later in the article (including setting the cache drive in position 1 instead of 0), I found the information in this article and started investigating drive size. The standard used to be 4 GB, but the VM devices are set for 8 GB RAM each (which means a larger PageFile). Even then, each device would need to have the disk activated and formatted before it would be recognized and used to “cache on device hard drive”. This would persist on a reboot of the provisioned device, even though the change was made with the vDisk in “Standard Image” mode, not “Private”. I concluded that once the cache disk was formatted, it would stay formatted and would persist on the device it was attached to.

I then created and formatted an 8 GB cache disk, formatted it while attached to a provisioned device, then detached and re-attached the disk to a different device. The device cached to the device hard drive, and the PageFile was automatically directed to the WriteCache on the device (even though the vDisk was set to C: and not changed). An expected behavior, but one that I had not been able to get working.

Thank you for pointing me in the right direction on this. The article has made it possible to repair instead of replace hundreds of provisioned devices.

Anonymous said...

Ann additional note: as a Windows 7 vDisk image, the "Diskpart Automount" was run, which may have been part of trhe solution.