For some time I've been playing with Wimb's great tools, in order to create a small Win7 image that can be booted on most computers (ideally anywhere...).
Note that I'm not trying to do anything exotic for now. All I do is:
- Install Win7 directly into a 10 Gb VHD container, with WinNTSetup
- Create a compacted 1.4 Gb VHD with Wimb's VHD_W7_Compact. I'm not even using any of the registry tweaks: I disable them all. I'm not using WinVBlock or FiraDisk: I'm using Win7 native VHD driver.
But from day one, I had this problem whereby the compacted VHD would only boot once. Any subsequent reboot results in a BSOD 7B.
So I started investigating a little bit...
Quickly I figured out that if after booting from the compacted VHD, I mount the image and replace the SYSTEM hive of the offline system with its pre-boot version then I can boot again (but still only once !)
In other words, the boot process is causing some changes in the registry, which prevents any further boot...
I will spare you the details of the million of experiments I carried out. Eventually I got to the point where I noticed that if you create two VHDs in Win7, a 1.4 Gb one and a 10 Gb one, the first partition will by default start respectively at sectors 128 and 2048. Now if I :
- Create a 10Gb VHD, with the same signature as Wimb's compacted VHD.
- Copy all the contents of the compacted VHD into this fresh, 10 Gb VHD.
- Adjust the MountedDevices entry of the new, 10 Gb VHD, to account for the different partition offset (see first regshot comparison, where shot A is 1.4 Gb VHD and shot B is 10 Gb VHD: Report before boot.html 4.15KB 676 downloads)
Therefore, it looks like there is something else than the key MountedDevices ought to be changed....
Now, if I boot my compacted VHD and shut-down, boot the equivalent 10 Gb VHD and shut-down, then compare the SYSTEM hives of the offline system, I get this second regshot result: Report after boot.html 23.46KB 1183 downloads
I can only see one very suspicious thing, but can't really explain it:
the registry key for the boot volume (created by the initial install in 10 Gb VHD), is deleted when the compacted VHD is booted (shot A), but no new registry key is created instead (for the new boot volume, since the partition offset is different). Why ? Also, if this is not critical to boot once, why would it become critical for subsequent boots ?
Anyone has any ideas what really happens ? What ought to be done to fix the problem ?
Also why am I apparently the only one to have this problem ? (presumably Wimb has successfully used relatively small images, say 2 Gb, with 128 sectors offset to the first partition)