The longer version: I have a stock Windows 7 image sitting in VMware Workstation that I use to create new VMs, to save time. I just snapshot and clone the stock image, and voila! a new Windows 7 VM. Now, I'm trying to use that same image with Windows Deployment Services (WDS) on Server 2012 to install Windows 7 to a Dell Optiplex 9010. Everything works fine, including the answer file for WinPE but NOT for post-install (still working on that), but once the installation is complete C:\ is WAY too big.

Upon further examination, I noticed that hiberfil.sys and pagefile.sys are 33GB and 25GB, respectively. This is MUCH larger than normal, and these outsized files do not appear when I use WDS to install the image in VMware. hiberfil.sys comes from Windows hibernate, and pagefile.sys is used by the RAM. Obviously I can't just go deleting them willy nilly.

Based on the files not appearing in the VM, it seems like they're being generated after deployment (as opposed to being captured as part of the image and then deployed out). The only difference between the installations is that the deployment to the physical machine also includes a driver set, which the VM deployment does not.

Short of disabling hibernation (which will shut down hiberfil.sys but not pagefile.sys), how can I prevent this giant files from appearing? Extra points if you can tell me why they're appearing.

EDIT: Turns out pagefile.sys is expanding because we're deploying the image to a machine with 16x RAM (32GB total). hiberfil.sys is so large because pagefile.sys is so large. We still don't know hiberfil.sys is showing up on machines with hibernation disabled (including the VMs), but at least we can disable it via the command line.

  • Interesting question, I haven't ran into this myself, yet anyway. – MDMoore313 Mar 11 '13 at 12:30

I would use powershell to disable the page file, or lower the page file size after deploying the image. After a reboot it should shrink or disappear.

This is quite easy for me since we use sccm osd, however it can still be done using wds alone. I haven't tested the code here yet, but there are different solutions across the net for it to be possible.

  • 1
    Good suggestion for Powershell. We don't have any Powershell scripters in my office, but we can learn and it should decrease post-install time. I'll use that as a starting point for the hiberfil problem too. For some reason, using the regular cmd prompt (elevated) does not persist after shutdown, but perhaps Powershell can help. – Will Mar 12 '13 at 21:10
  • That's [elevated cmd promp] weird that it's not persistant. The powershell scripts I've seen write directly to wmi for the page file, I can test it and post my results. We do however use powercfg to disable hibernation via command line and it works well. I recommend this book for a good intro to powershell, they have a 2nd edition now as well. – MDMoore313 Mar 12 '13 at 22:31
  • Good catch, thanks. powercfg is what we've used, and we now suspect that our previous imaging software (Acronis SnapDeploy) may be to blame. Thanks for the powershell link, I'll get right on that. – Will Mar 13 '13 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.