Windows 7: Creating Recovery Partition on MBR Drive

Steps to create Recovery Partition for Windows 7 MBR drive

These steps are performed from Windows recovery environment using Windows 7 WinPE or Installation Media.

Need three partitions:

  • System Reserved (500 MB) 
  • Recovery Partition (5 GB Depends on the size of customize install.wim) 
  • Windows Partition (20 GB)

select disk 0

create partition primary size=500

format quick fs=ntfs label="System"

assign letter="S"

active

create partition primary size=20480

format quick fs=ntfs label="Windows"

assign letter="W"

create partition primary size=5172

format quick fs=ntfs label="Recovery image"

assign letter="R"

exit

Note:

In Windows® 7, you can install a Windows RE image on any primary NTFS partition that is on the same disk as your Windows installation, provided the partitions is one of the following types:

  • • MBR disks Type 0x7 or type 0x27. If type 0x27, it must be at the beginning of the disk.
  • • GPT disks   Contains the PARTITION_MSFT_RECOVERY_GUID attribute.

In this example we are using ID 0x7. ID 0x7 means NTFS.


Apply Install.wim using Imagex on windows partition

imagex64.exe /apply install.wim 3 W:\ /verify  (Here w: is windows partition and index 3 is as per indexes  mentioned below).

So by this command we are applying Windows 7 Professional

Index : 1

Name : Windows 7 HOMEBASIC

Description : Windows 7 HOMEBASIC

Size : 11,710,161,360 bytes

Index : 2

Name : Windows 7 HOMEPREMIUM

Description : Windows 7 HOMEPREMIUM

Size : 12,222,587,449 bytes

Index : 3

Name : Windows 7 PROFESSIONAL

Description : Windows 7 PROFESSIONAL

Size : 12,122,886,417 bytes

Index : 4

Name : Windows 7 ULTIMATE

Description : Windows 7 ULTIMATE

Size : 12,285,492,779 bytes


Generate BCD and BootMGR on system partition

BCDBoot w:\windows

Bootrec /rebuildbcd


Copy Winre.wim from w:\windows\system32\recovery to System partition (S:)

mkdir S:\Recovery\WindowsRE

move W:\Windows\System32\Recovery\winre.wim S:\Recovery\WindowsRE

Note: You can store the Winre.wim file on any drive, but you must place it in the following directory structure: \Recovery\WindowsRE


>Copy Install.wim or customize Image (Note: name should only be Install. wim) to recovery partition

>Configure your custom Windows RE image and specify that when the F1 key (scan code = 0x3b00) is pressed during startup, Windows RE and the custom recovery application launch:

W:\Windows\System32\Reagentc.exe /setreimage /path S:\Recovery\WindowsRE  /target W:\Windows /bootkey 3b00       - This command will take effect after OOBE.

For other example of keyboard scan codes like above please use below mentioned link. Examples

F1

0x3b00

F2

0x3c00

https://technet.microsoft.com/en-us/library/dd799242(v=ws.10).aspx


Configure Windows RE to recognize your Windows 7 image (.wim) file residing on recovery partition

W:\Windows\System32\Reagentc.exe /setosimage /path R:\ /target W:\Windows

Note: We can use this  command as well in place of above mentioned command.

 reagentc /setosimage /path \?\Volume{A435DECF-B690-11E4-23AC-00155D095900}  /index 1 /target D:\Windows

 In this we are using a volume GUID in-place of volume name. We can obtain above Disk UNC path GUID using mountvol command.


Boot the machine till OOBE and test your recovery partition. This pre-staged tool will be use to triggering recovery using F1 key and from Backup and recovery option, as mentioned below.

Now test your recovery environment.

Scenario 1

  1. Remove the CD-ROM and any USB drives.
  2. Start the destination computer and complete Windows Welcome.
  3. Click Start, click Control Panel, click System and Security, click Backup and Restore, and then click Recover system settings or your computer.
  4. Click Advanced recovery methods and then click Reinstall Windows
  5. Follow the on-screen instructions. The computer restarts.
  6. Verify that the computer starts in Windows RE. The system reinstalls Windows by using the image that you placed in the recovery partition. When the installation is complete, you have the option to restore other files you have backed up.

Scenario 2 , Trigger Re using F1

  1. Remove the CD-ROM and any USB drives.
  2. Restart the computer.
  3. Start the destination computer and complete Windows Welcome.
  4. Restart the computer. Immediately after POST, hold down the F8 key. The Advanced Boot Options menu appears.
  5. Select Repair your computer and then press Enter. Windows RE starts.
  6. Follow the on-screen instructions to select a keyboard layout and provide credentials.
  7. Verify that a link to your custom recovery application appears on the Windows RE menu.
  8. Restart the computer.
  9. Immediately after POST, hold down the F1 key. Windows RE starts.
  10. Verify that your custom recovery application launches automatically.