Site icon WindowsLoop

How to Create a Recovery Partition in Windows 10 (Custom Factory Reset)

Recovery partition

If you bought a pre-built system or a laptop, you might have seen a factory reset option which resets Windows 10 to its factory built state. Using the recovery partition, you can easily restore Windows when it is corrupted or cannot boot. Let me show you how to create a Windows 10 recovery partition of your own in simple steps.

A Few Things Before You Can Create Your Own Custom Recovery Partition in Windows 10

Before you can create a recovery partition in Windows 10, there are a few things you need to know and should have.

1. Keep your Windows 10 installation media ready. We are going to use the windows 10 installation drive to extract the OS image which can then be used to create a recovery image. If you don’t have the installation media, you can easily create a Windows 10 USB drive yourself. Make sure that the installed Windows 10 version and downloaded Windows 10 ISO version is the same. For instance, if I’m using Windows 10 v1809, the installation media should also be of v1809.

2. You should know how to create a partition. To create a partition, you can use the built-in disk management tool or third-party software like EaseUS Partition Manager.

3. Make sure that you’ve installed all the Windows updates and software that you use regularly. This makes it sure that when you restore your system using the recovery partition, you will have all your software ready to use.

4. This is not necessary but makes your life easier when using the command prompt. In the File Explorer, rename the C Drive to something you can easily recognize. For instance, I renamed my drive to OS Drive. To rename a drive, simply right-click on the drive and select “Rename”.

Create Recovery Partition in Windows 10

Creating a custom factory reset partition in Windows 10 is fairly simple. However, it is lengthy. So, to make matters simple, I’ve divided the steps into three sections. Just follow the below steps as is and you should be good.

1.1 Extract Windows Image to Create Windows 10 Recovery Partition

The first thing we need to do is extract the Windows 10 image. However, since you cannot extract the Windows 10 image while you are using it, we need to boot into the Windows 10 installation media.

1. Plug in the Windows 10 installation drive, reboot your system and boot into the installation media.

2. In the language selection screen, press Shift + F10 to open the command prompt window.

3. When you boot into Windows 10 installation media, there is a chance the drive letters will be changed temporarily. So, it is better to know the current drive letter of the OS installation drive and the drive where you’d like to store the extracted image file. To know the drive letter, we need to use the diskpart utility. So, execute the below command.

diskpart

4. Next, use the below command to list all the volumes in your system. In my case, the drive letter didn’t change. So, my OS installation drive letter is still C and the drive where I want to save the extracted image is D. Remember both drive letters, you need them in the next step.

listvol

5. Once you know the drive letters, exit the diskpart tool using the below command.

exit

6. Now, use the below command to extract the OS image and save it to the drive of your choice. Don’t forget to replace <DestinationDriveLetter> with the actual destination drive letter and <OSInstallationDriveLetter> with the actual OS installation drive letter.

dism /capture-image /imagefile:<DestinationDriveLetter>:\install.esd /capturedir:<OSInstallationDriveLetter>:\ /name:"Recovery" /compress:maximum

Once you add the drive letters, the command will look something like this. I’m extracting the Windows 10 image from C drive and storing it in the D drive.

dism /capture-image /imagefile:D:\install.esd /capturedir:C:\ /name:"Recovery" /compress:maximum

7. As soon as you execute the above command, Windows starts to extract the image. It can take some time to complete.

8. Once that is done, the extracted image will be saved to the drive you chose earlier. Close the command prompt window and reboot Windows 10.

9. After rebooting Windows, if you go the drive where you save the extracted image, you will see a file named “install.wim”. In my case, the install.wim file is around 5GB. This can vary depending on the applications and updates you’ve installed.

1.2 Copy Windows 10 Installation Files to Recovery Partition

10. Now, create a new partition that is a couple of gigabytes bigger than the size of the install.wim file. For instance, if your extracted install.wim file is around 10GB, create a new partition that is around 12GB. Remember the drive letter of the new partition, we are going to need it in the coming steps.

11. Now, plug in the Windows 10 USB drive, copy all the files in it and paste them in the new partition.

12. Next, copy the extracted “install.wim” file and paste it inside the “sources” folder in the new partition. You will see a duplicate file warning. Select “Replace” to replace the already existing “install.wim” file with the newly extracted “install.wim” file.

1.3 Add Recovery Partition to Advanced Boot Menu

Up until now, we’ve only created the recovery partition. We now need to add that recovery partition to the advanced boot menu. We are going to do that using a batch file. This allows you to boot into recovery from the advanced startup options.

13. Right-click on the desktop and select “New -> Text document”.

14. Rename the text file to “recovery.bat”. You can name the file anything you want, just make sure that the file extension ends with .bat.

15. Right click on the batch file and select “Edit”.

16. Paste the following code in the notepad and click on the “File -> Save” option. Close the file after saving.

Important note: If you are on a Legacy BIOS system, change “winload.efi” in line 21 to “winload.exe”. If you don’t know, you can easily check if you are on a UEFI or Legacy BIOS system.

@ECHO OFF
TITLE Add Recovery to Windows boot menu
:SETLETTER
CLS
ECHO.
ECHO ###################################################
ECHO # This batch file creates recovery environment    #
ECHO # adding it to Windows boot menu.                 #
ECHO ###################################################
ECHO.
SET /P DRIVELETTER= ^-- Please enter drive letter for your custom recovery partition (without colon): 
IF NOT EXIST %DRIVELETTER%:\sources\boot.wim ECHO. & ECHO No valid Windows image found on given partition %DRIVELETTER% &ECHO. & PAUSE & GOTO :SETLETTER
ECHO.
bcdedit /create {ramdiskoptions} /d "Ramdisk"
bcdedit /set {ramdiskoptions} ramdisksdidevice partition=%DRIVELETTER%:
bcdedit /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi
for /f "tokens=2 delims={}" %%i in ('bcdedit.exe /create /d "Recovery" /application OSLOADER') do (set guid={%%i})
bcdedit /set %guid% device ramdisk=[%DRIVELETTER%:]\sources\boot.wim,{ramdiskoptions}
bcdedit /set %guid% path \windows\system32\winload.efi
bcdedit /set %guid% osdevice ramdisk=[%DRIVELETTER%:]\sources\boot.wim,{ramdiskoptions}
bcdedit /set %guid% systemroot \windows
bcdedit /set %guid% winpe yes
bcdedit /set %guid% detecthal yes
bcdedit /displayorder %guid% /addlast
pause

18. Open the start menu, search for the command prompt, right-click on it and select the “Run as administrator” option.

19. Since the batch file is on the desktop, use the below command to go to the desktop. Replace <username> with your actual Windows 10 username.

cd c:\users\<username>\desktop

20. Once you are in the desktop, execute the batch file with its name.

21. As soon as you execute the file, the command prompt will ask you to enter the recovery partition drive letter. Type the drive letter and press Enter. In my case, the recovery partition drive letter is F.

22. The script will now add the recovery partition to the advanced startup boot options menu. Once the script has been executed successfully, you can close the command prompt window.

That is it. You’ve successfully created your own recovery partition in Windows 10 and added it to the boot options.

Windows 10 Create Recovery Partition Conclusion

As you can see, it is pretty easy to create a recovery partition in Windows 10. To see the recovery partition you need to boot into advanced startup options. To do that, open the Settings app, go to “Update and Security -> Recovery” and click on the “Restart Now” button under Advanced Startup. In the Advanced Startup options, click on the “Use another operating system” option.

You will see the recovery option.

If you ever cannot boot into Windows, simply boot into the Windows 10 installation media, press Shift + F10 to open the command prompt, and execute the below command. Replace <DriveLetter> with the actual drive letter of the recovery partition. This action will reinstall Windows with all your applications and updates intact.

<DriveLetter>:\setup.exe

Once you replace the actual drive letter, this is how the command should look like.

F:\setup.exe

Hope that helps. If you like this article, do check out how to lock folder in Windows 10 and how to change timezone in Windows 10.

Exit mobile version