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.