After several years of using Windows on physics machines, I finally found a better way to quickly fix, restore, and create a new installation of Windows. – To boot a Windows from VHDX file.
Note
For more information, see this official document. This is not the topic of this article.
However, in the past few years, how I replace the old VHDX with the new one becomes a quite tricky job, certainly from my current perspective.
My old way is as follows:
Assume we have 3 VHDX files placed in X:
drive:
X:\Windows-11.vhdx
(old/my current used one)
X:\Windows-11-Recovery.vhdx
(mediator)
X:\Windows-11-New.vhdx
(new one)
If I want to replace the old one with the new one, I have to do the following steps:
- Boot into the
Windows-11-Recovery.vhdx
- Rename the
Windows-11.vhdx
to Windows-11-Old.vhdx
- Rename the
Windows-11-New.vhdx
to Windows-11.vhdx
- Reboot into the new VHDX (Use the same boot menu entry as the old one)
I was thinking about follow the Android A/B partitioning way, and then I suddenly realized that the naming strategy is quite ugly and will make more misunderstanding. So I decided to use the above way.
I could say this is really brilliant, until I got fxxked by the Windows RE.
Notice
Don’t get me wrong, I think the Windows RE is a great feature.
Read this article if you are interested: Windows Recovery Environment explained.
But it’s just fxxked up by other things.
The problem
So what’s the problem?
The problem is, after I boot into the mediator VHDX and finish the renaming job, I reboot into the new VHDX, and then I found that the new VHDX is not bootable. It tells me similar to the below image:
And then I try to rename it back. But it still tells me the same thing.
So, why is this happening?
The cause
The cause is simple, but it’s not easy to notice.
The Winre.wim
file in the Recovery
partition is mysteriously disappeared. I assume it is because the Recovery
partition is too small to hold the Winre.wim
file.
Because when I copy the Winre.wim
file from a Windows 11 ISO to the Recovery
partition, it tells me that the Recovery
partition is too small.
The solution
Thanks to the awesome official document to guide me grab needed commands to fix this issue.
Due to my current EFI
and Recovery
partition being completely fxxked up, I have to buy a new USB flash drive to and create a new Windows To Go on it. Then I booted into Windows To Go and started to fix the issue.
First I need to recreate my EFI
and Recovery
partition. I use the diskpart
command to do this.
Then I use the bcdboot
command to fix the boot files.
Finally, I use the Reagentc
command to set the Winre.wim
file to the Recovery
partition.
After all these steps, I reboot into the VHDX, and it works!
Note
All the commands are available in the references section.
Since I have a Windows To Go USB Flash Drive, I no longer need a mediator VHDX to do the replacement job :).
This can also reduce at least 20GB of space in my X:
drive.
References