I had to clone my hard drive from a bigger one to a smaller one and in the process I lost the recovery partition that was at the end of the hard drive. It was a 500MB partition. I'm running the latest version of Windows 10. Is it possible to restore that partition?
2 Answers
This is an example of the process of restoring recovery partition on Windows 10, if there is no recovery partition at all. In addition, I suggest, if there is one which is not functioning then delete the partition/volume and redo from scratch. Use with caution! Using only Microsoft tools, so one can be 100% sure there is no security issue.
Download & Create Microsoft Windows ISO for your system https://www.microsoft.com/en-us/software-download/windows10 or ...windows11.
Create
C:\wimandC:\wim\installmkdir c:\wim mkdir c:\wim\installMount the ISO image or use the DVD; locate
\sources\install.esdfile and copy toC:\wimList all the versions:
Dism /Get-WimInfo /WimFile:c:\wim\install.esd... ... Index : 4 Name : Windows 10 Education Description : Windows 10 Education Size : 15,613,170,917 bytes
Index : 5 Name : Windows 10 Education N Description : Windows 10 Education N Size : 14,857,698,925 bytes
Index : 6 Name : Windows 10 Pro Description : Windows 10 Pro Size : 15,625,575,440 bytes ... ...
Extract
install.wimfor your system - have 15GB free spaceDism /Export-Image /SourceImageFile:C:\wim\install.esd /SourceIndex:6 /DestinationImageFile:C:\WIM\install.wim /Compress:max /CheckIntegrity... ... Deployment Image Servicing and Management tool Version: 10.0.19041.3636
Exporting image [==========================100.0%==========================] The operation completed successfully. ... ...
Get info from the extracted
C:\wim\install.wimDism /Get-WimInfo /WimFile:c:\wim\install.wim... ... Deployment Image Servicing and Management tool Version: 10.0.19041.3636
Details for image : c:\wim\install.wim
Index : 1 Name : Windows 10 Home Description : Windows 10 Home Size : 15,276,446,585 bytes
Index : 2 Name : Windows 10 Pro Description : Windows 10 Pro Size : 15,625,575,440 bytes
The operation completed successfully. ... ...
Decompress files
Dism /apply-image /imagefile:c:\wim\install.wim /index:2 /ApplyDir:c:\wim\installLocate
C:\wim\install\windows\system32\recovery\Winre.wimand copy (for clarity only) toC:\wim, theWinre.wimis the only file needed. You can delete all else created in the process from disk.Check the
Winre.wimDism /Get-WimInfo /WimFile:c:\wim\winre.wim... ... Deployment Image Servicing and Management tool Version: 10.0.19041.3636
Details for image : c:\wim\winre.wim
Index : 1 Name : Microsoft Windows Recovery Environment (x64) Description : Microsoft Windows Recovery Environment (x64) Size : 2,244,440,228 bytes
The operation completed successfully. ... ...
Necessary disk operations (explaining each step is over the scope of this contribution, as it would become a book - research every step!) if you do not know what each command does do not continue!
diskpart list disk... ... Disk ### Status Size Free Dyn Gpt
Disk 0 Online 931 GB 1024 KB * ... ...
select disk 1
... ... Disk 1 is now the selected disk. ... ...
list volume
... Volume ### Ltr Label Fs Type Size Status Info
Volume 0 D DVD-ROM 0 B No Media ... ...
select volume 2
... ... Volume 2 is the selected volume. ... ...
shrink desired=1500 create partition primary format quick fs=ntfs assign letter=r
Create directory
R:\Recovery\WindowsRE\mkdir R:\Recovery\ mkdir R:\Recovery\WindowsRE\Copy the image
C:\wim\Winre.wimtoR:\Recovery\WindowsRE\Set GUID for the partition to mark it as "Recovery" type.
diskpart list disk select disk 1 list partition select part 4 set id=DE94BBA4-06D1-4D40-A16A-BFD50179D6ACSet RE image
reagentc /setreimage /path R:\Recovery\WindowsRE\... ...
Directory set to: \?\GLOBALROOT\device\harddisk1\partition4\Recovery\WindowsREREAGENTC.EXE: Operation Successful. ... ...
Remove the leter from volume
diskpart list disk select disk 1 list volume select volume 5 remove letter=RRe-enable the "Recovery" system
reagentc /enable... ... REAGENTC.EXE: Operation Successful. ... ...
That concludes the process. The recovery partition is not necessary for the OS to function. The process is possible to repeat. I suggest to test the process for any version of Windows first in a virtual environment. It has been slightly different in past and one can assume it will be so in future.
- 1,511
- 3
- 15
- 19
- 41
-
I'd add that if you already are in a virtual environment, take a snapshot first (maybe even start with a clone). – mbmast Mar 24 '24 at 01:57
Check the current state of your Windows recovery:
reagentc /infoCreate an empty 1GB partition in the end of your system drive.
- You might need to shrink your previous partition to free some space. If Windows Disk Manager would be unable to shrink it, use GParted live USB.
Mark partition type as recovery
27for BIOS/MBR (orDE94BBA4-06D1-4D40-A16A-BFD50179D6ACfor UEFI/GPT). In cmd:diskpart,list diskselect disk 0,list part,sel part 3,det part,set id=27,exit.- This just an example, make sure to select the correct partition!
Disable and enable Recovery to move it to the new partition:
reagentc /disable,reagentc /enable.Verify that Recovery is now on the new partition:
reagentc /info
Here's a nice video guide.
- 1,590
- 1
- 14
- 27
-
1There is never a need to use a Linux-based utility to configure WinRE (please see
shrinkindiskpart), andid=27is for BIOS only, UEFI requires entirely different steps – JW0914 Jan 05 '24 at 11:56 -
I personally ran into the inability to shrink my OS partition from Windows itself yesterday. Not sure why, but this was not the unmovable files issue. Thanks for noting that GPT recovery partition ID is different, I fixed this – i3v Jan 06 '24 at 21:13
winre.wimdoesn't exist within%WinDir%\System32\Recovery, use the Windows Media Creation Tool to download the Windows 10 install ISO, opensources\install.esdwithin 7zip, choose folder1for Home or6for Pro, navigate toWindows\System32\Recovery, and extractwinre.wim. From there, proceed with the steps in the aforementioned answer. Note: there are different WinRE partition creation steps depending if you have BIOS or UEFI – JW0914 Jan 05 '24 at 11:54