VHD Resize [2]

A couple of posts back I wrote about getting a native VHD down to a smaller size to use on a system with a smaller HDD than what it was originally built on. That time I just used standard defrag along with shrinking in Disk Management. This time around that wasn’t going to get the VHD small enough to fit on an 80 GB HDD so I had to try another option. Helpfully Defrag will put information into the event log about immovable files. Using that I worked out I needed to boot the VHD and turn off System Restore in the OS, then mount the VHD in another OS and defrag it again, then shrink again. This time, success!!!! The VHD shrunk massively to 20 GB. After considering the further options, I then expanded it again, up to 50 GB.

After doing this you still need to change it from a dynamic 127 GB file (in this case) to something smaller. Even though it only has a 50 GB partition in it, Windows 7 will still try to expand it to the full 127 GB at startup, which of course fails. So VHDResizer is the next step to get it to, in this case, a dynamic 50 GB file.

There are still a few things I don’t understand, like why a VHD that physically only needs 32 GB of disk space can’t be shrunk in partition size below 72 GB. I presume that the dynamic format compresses zeros or blank space, but if it can manage this then it should be possible to defrag that blank space as well, instead we get the fiction that the unmovable file can’t be shifted, yet we know it is possible with third party tools.

The next little hassle with the target was to get it to boot Windows PE. When I fed it the pen drive, it spat it out. So then I had to spend a lot of time creating a Windows PE 3.0 boot CD, and that is like chalk and cheese compared to the pen drive; it displays the old Vista progress bar instead of the Windows 7 startup animation, and takes a lot longer, with much more blank screen, to get to the command prompt window. From there, after following the standard amount of initialisation of the disk and copying the VHD, it was a surprisingly short step to booting up on the VHD and getting this unsysprepped image to start.


Posted

in

by

Tags: