Recovery 169-580-90We do a fair amount of data recovery from hard drives that are still functional, but for whatever reason have a number of bad sectors. So if a tool like Acronis cannot clone the drive because there is significant file system damage, we’ve had great luck with the Linux dd_rescue tool in the System Rescue CD.

However, some problems crop up when you rescue clone from an older hard drive onto a newer Advanced Format Drive – dd_rescue has no concept of the new AFD layout. Tools are available from most HD manufacturers to repair this misalignment, but afterwards it can cause other problems. For most Windows Vista and 7 computers, there is a recovery partition on drive D:  Often after alignment, the boot information is incorrect and the boot loader cannot start the WinRE environment on Drive D:After much trial, error, and research – we were able to fix most issues with the F8 Recovery console on Vista and Windows 7.

The good news is, it is fairly easy to fix if you don’t mind getting your hands dirty in a command window.

Start an Admin level command window, and type this command:

bcdedit /enum all

This will list out all the information in your bootloader database.

Here is what a common one looks like (from a Dell):

Windows Boot Manager
——————–
identifier              {bootmgr}
device                  partition=D:
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {4871f5b7-2b25-11e1-88d4-d067e53f9824}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
——————-
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows 7
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {4871f5b9-2b25-11e1-88d4-d067e53f9824}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {4871f5b7-2b25-11e1-88d4-d067e53f9824}
nx                      OptIn

Windows Boot Loader
——————-
identifier              {4871f5b9-2b25-11e1-88d4-d067e53f9824}
device                  ramdisk=[D:]\Recovery\WindowsRE\Winre.wim,{4871f5ba-2b25-11e1-88d4-d067e53f9824}
path                    \windows\system32\winload.exe
description             Windows Recovery Environment
inherit                 {bootloadersettings}
osdevice                ramdisk=[D:]\Recovery\WindowsRE\Winre.wim,{4871f5ba-2b25-11e1-88d4-d067e53f9824}
systemroot              \windows
nx                      OptIn
winpe                   Yes

Resume from Hibernate
———————
identifier              {4871f5b7-2b25-11e1-88d4-d067e53f9824}
device                  partition=C:
path                    \Windows\system32\winresume.exe
description             Windows Resume Application
locale                  en-US
inherit                 {resumeloadersettings}
filedevice              partition=C:
filepath                \hiberfil.sys
debugoptionenabled      No

Windows Memory Tester
———————
identifier              {memdiag}
device                  partition=D:
path                    \boot\memtest.exe
description             Windows Memory Diagnostic
locale                  en-US
inherit                 {globalsettings}
badmemoryaccess         Yes

EMS Settings
————
identifier              {emssettings}
bootems                 Yes

Debugger Settings
—————–
identifier              {dbgsettings}
debugtype               Serial
debugport               1
baudrate                115200

RAM Defects
———–
identifier              {badmemory}

Global Settings
—————
identifier              {globalsettings}
inherit                 {dbgsettings}
                        {emssettings}
                        {badmemory}

Boot Loader Settings
——————–
identifier              {bootloadersettings}
inherit                 {globalsettings}
                        {hypervisorsettings}

Hypervisor Settings
——————-
identifier              {hypervisorsettings}
hypervisordebugtype     Serial
hypervisordebugport     1
hypervisorbaudrate      115200

Resume Loader Settings
———————-
identifier              {resumeloadersettings}
inherit                 {globalsettings}

Device options
————–
identifier              {4871f5ba-2b25-11e1-88d4-d067e53f9824}
description             Ramdisk Options
ramdisksdidevice        partition=D:
ramdisksdipath          \Recovery\WindowsRE\boot.sdi

The important sections are the two Windows Bootloader entries and the Device Options section. We’ll go through them in reverse order since they depend on each other…

First – make sure your Recovery partition has a drive letter assigned. It usually is D: but not always. Some vendors hide their recovery partition – if so, these directions won’t work. I know Dell and HP list the recovery partition as a drive. If you need to assign the drive letter, turn the computer off and remove/disconnect any DVD drives. Reboot, Control Panel -> Administrative Tools -> Computer Management. Click on Disk Management and look for the recovery partition. Right click and select Change Drive Letter and Paths. Click the Add button and select D: from the pulldown. If it’s not listed – make sure you don’t have another drive listed on D:

CAUTION!!! This article makes significant changes to the bootloader of our computer and mistakes can EASILY render your system unbootable! Make SURE you backup your BCD before trying anything here:

bcdedit /export c:\bcdbackup

In case of disaster, you can restore your BCD from this backup using a recovery DVD (Google is your friend)

Now on to each section…

Device options
————–
identifier              {4871f5ba-2b25-11e1-88d4-d067e53f9824}
description             Ramdisk Options
ramdisksdidevice        partition=D:
ramdisksdipath          \Recovery\WindowsRE\boot.sdi

The identifiers (GUID) will vary FOR EACH SECTION – just make SURE you have the right ones (cut and paste are your friend!) The most common problem I’ve seen with this is the ramdisksdidevice is listed as ‘Unknown’ and/or the path is incorrect. Make sure your Folder View is set to NOT hide files and to Show protected system files. Then browse into the D: drive and find where the boot.sdi file is. Make sure the path matches. To fix (substituting the proper GUID identifier and path):

bcdedit /set {GUID} ramdisksdidevice \Recovery\WindowsRE\boot.sdi
bcdedit /set {GUID} ramdisksdidevice partition=D:

If this section looks OK, lets take a look at the Recovery Console entry for the bootloader:

Windows Boot Loader
——————-
identifier              {4871f5b9-2b25-11e1-88d4-d067e53f9824}
device                  ramdisk=[D:]\Recovery\WindowsRE\Winre.wim,{4871f5ba-2b25-11e1-88d4-d067e53f9824}
path                    \windows\system32\winload.exe
description             Windows Recovery Environment
inherit                 {bootloadersettings}
osdevice                ramdisk=[D:]\Recovery\WindowsRE\Winre.wim,{4871f5ba-2b25-11e1-88d4-d067e53f9824}
systemroot              \windows
nx                      OptIn
winpe                   Yes

NOTE! The identifier here may be VERY similar to the device options on, but it’s NOT. It may vary by ONE character. The GUIDs in the device and osdevice sections should match the GUID from the Device options section we looked at earlier. Just like before, check and make sure the path is right to the Winre.wim file, which is the recovery image that boots when you select Repair Your Computer. Most often, the device and osdevice fields are incorrect. If you update them, the others SHOULD update correctly on their own:

bcdedit /set {GUID1} device ramdisk=[D:]\Recovery\WindowsRE\Winre.wim,{GUID2}
bcdedit /set {GUID1} osdevice ramdisk=[D:]\Recovery\WindowsRE\Winre.wim,{GUID2}

Where GUID1 is the Boot Loader ID and GUID2 is the Device Options ID for the RamDisk. Run bcdedit /enum all and see how that section looks. If the other fields did not update, set them manually:

bcdedit /set {GUID1} path \Windows\system32\winload.exe
bcdedit /set {GUID1} description “Windows Recovery Environment”
bcdedit /set {GUID1} inherit {bootloadersettings}
bcdedit /set {GUID1} systemroot \Windows
bcdedit /set {GUID1} nx OptIn
bcdedit /set {GUID1} winpe Yes

where GUID1 is the identifier for the Recovery Boot Loader section.

Finally, we need to make sure the recovery partition is known to the bootloader:

Windows Boot Loader
——————-
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows 7
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {4871f5b9-2b25-11e1-88d4-d067e53f9824}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {4871f5b7-2b25-11e1-88d4-d067e53f9824}
nx                      OptIn

Sometimes, the recoverysequence and recoveryenabled sections are incorrect. To fix, do the following:

bcdedit /set {current} recoverysequence {GUID1}
bcdedit /set {current} recoveryenabled Yes

where GUID1 is the identifier for the Recovery Partition Windows Boot Loader section.

When you’ve made these changes, try another bcdedit /enum all and see if things look better. If so, reboot and try F8. You should be able to get into your recovery partition now!

FYI, I have tried to use this setautofailover.cmd method, but it created bogus entries in the BCD and never seemed to work right…
http://www.sevenforums.com/backup-restore/158549-restoring-vista-windows-7-laptop-2.html#post1363726

HPs add some additional stuff to their bootloader, so it may look a little different (See http://forum.acronis.com/forum/6758?page=4)

References:
https://wiki.archlinux.org/index.php/Disk_Cloning#Backing_up_the_MBR
http://paulski.com/zpages.php?id=1913
http://www.sevenforums.com/tutorials/2676-bcdedit-how-use.html
http://forum.acronis.com/forum/6758
http://www.sevenforums.com/general-discussion/197380-f8-repair-your-computer-stops-working-0xc000000e.html