How To Rebuild A Deleted “Recovery Partition”

First we will need to download the ISO for the same Operating System, or OS ,that we are going to build back the “Recovery Partition” for. If you were not aware, an ISO is a bootable image that contains the full OS.

Microsoft changes the location of these ISO so I will not bother to link it here, but with the correct key words, in my case, “server 2022 bootable recovery iso”, it was the first link.

We will download this to our local PC, as the VM server that needs the recovery partition rebuilt is cutoff from the internet and has internal network access only. Once downloaded we will open the ISO in Windows Explorer (the folder icon on your toolbar). In this case, the one I downloaded is named, “SERVER_EVAL_x64FRE_en-us.iso” and we will double click it to open it.

Once opened we will open the “sources” folder.

Inside the “sources” folder we are looking for an “install” file. This could be an, “install.esd” or in our example it is an “install.wim”, but it needs to be a “install” file.

We will need to open this file with 7-Zip, so if you don’t have it already installed, you can get it here. Once you have it installed, we will right click the “install” file and go to “7-Zip” and then to “Open archive”. On Windows 11 you may have to go to “Show more options” first.

Once open we will open the “1” folder and then follow the path 1\Windows\System32\Recovery.

Here we arrive at two files that we need to retrieve. The “ReAgent.xml” and the “Winre.wim” will need to be extracted with the “Extract” button.

Here we will change the path to a location that we can find in the next step. In this case I am just changing the letter “E” to a “C” so that it is extracted to “C:\sources\” location.

After it has completed we can close out 7-Zip as we will no longer need it for this tutorial, but remember the extracted location.

Now we are going to RDP into our server (or PC) and we will paste the files onto the Desktop. The reason we paste it here is because we are not allowed to paste from a RDP session into the System32 folder for security reasons. We can, however, paste from the Desktop of the same computer system. So once the two files are on the Desktop we will copy them again from their new location.

Hidden Files

Now let’s navigate to the C:\Windows\System32\Recovery, on our demo server, and we will see that we already have a “ReAgent.xml” file at this location. If we paste the files here we will get a “Replace or Skip Files” dialog box. If you notice it states “The destination has 2 files” when we only see one file.

Even if we check the box under “View” tab for “Hidden Items” it is not there. We need to go under “Options”, then under the “View” tab uncheck the “Hide protected operating system files (Recommended)”. Once applied you will see the two files.

Here are our two files.

And once we paste them in, here are the files that we have replaced over the original files.

Creating The Recovery Partition

To create the recovery partition we will need to have a 1GB partition on the existing hard drive space. To do this we will right click the Start button and click on “Disk Management”.

If you are following from the previous tutorial “How to Expand C:Drive Without Third Party Software” where we had already made a 1GB partition, you can skip creating this partition.

In order to create this partition we will shrink the C:\Drive by right clicking the “(C:)” partition on “Disk 0” and selecting “Shrink Volume…”.

We can see in this example that the size available to shrink is 54915MB. In order to get our 1GB we will shrink 1024MB from the total shrinkable of 54915MB.

Now we have our 1GB partition.

Now we will right click our new partition and click on “New Simple Volume…”

We will use the entire 1024MB partition. If you have a larger partition then manually put in 1024.

Here we choose “Do not assign a drive letter or drive path”.

Leave everything else to defaults and finish.

Partition Style of Disk 0

Now we need to match the “Partition Style” of Disk 0 by right clicking Disk 0 and selecting “Properties”.

Under the “Volumes” tab we can see, in the example’s case, next to “Partition style” this is a “GUID Partition Table (GPT)”. If yours is a “Master Boot Record (MBR)” then remember its style.

Now we will change our newly created partition into a “Recovery” partition. To do this we need to use “diskpart”. We will type diskpart in the search bar and run the search. We can also open a command prompt and type diskpart.exe. Either way gets us there.

OR

We will now run the following commands.

1. list disk

This will show us all our disk. In this case there is only disk 0.

2. select disk 0

This will select our disk that has the partition on it.

3. list partition

We want to make sure we list the partitions so we can select the correct one.

As we can see, Partition 4 is the partition that has the 1024MB space that we created earlier.

WARNING: It is highly important that we select the correct partition. If we were to select the partition with (C:) and we moved forward with this tutorial we will lose our Operating System (OS). Please select the partition that is our new partition and the best way to tell is by the size of the partition.

Now that we have verified the correct partition size we will select it by running the “select partition 4” command. If your partition has a different number you will enter that number.

Now depending on our “Disk Style”, that we remembered earlier, we will enter one of the following commands.

A. If the Disk Style was a Master Boot Record (MBR) you will enter the following command.

B. If the Disk Style was a GUID Partition Table (GPT) you will enter the following two commands.

In our example it was a GPT so we ran commands for B.

If we look at Disk Manager it looks like we are finished, but we have one final part to complete.

Enabling Recovery Environment

The final step is to open a command prompt by typing “cmd” in the search bar and hitting enter. Once opened, enter the following command and hit enter.

As we can see the command was successful.

To validate that we have success, we will enter the command “reagentc /info”.

Here we can see that we were successful!

That’s it! Now there is only one other thing I want to add to this. If when I navigated to the the “Recovery Options” by typing “recovery options” in the search bar and click “recovery options” result.

You may notice that it is blank, as I did, on my Server 2022 I am using in the demo.

From back in my “Computer Repair” days, I know that to simulate an actual Window computer that won’t startup you do something that seems a little crazy at first. Once the computer begins the startup process, you pull the power cable! You plug it back in, and power it back on, and do it again. After the third or forth time the computer will automatically (by design) go into recovery mode by stating, “Repairing computer…..” I did this first to my example VM server by “Hard Reset”-ing it and it did go into recovery mode. So I know the steps performed above work up to this step.

I booted the server up normally and upon startup it performed an update. For those who are not familiar, sometimes Windows will state that it is updating at startup, but it is not updating from the typical downloaded updates from Microsoft, but it is instead repairing something that is not correct on the computer itself. In this case, it seems to be building the recovery files. Once it had rebooted I rechecked the “Recovery Options” and it was now populated.

We can now click the “Restart now” button and it will now boot in recovery mode. I hope you have enjoyed this tutorial and that it has been helpful to you.

Please take the time to let me know what you think of this tutorial and if you had any issues. I will attempt to respond when I get an opportunity.

Leave a Reply

Your email address will not be published. Required fields are marked *