Super User Asked by trananhtuan on December 21, 2021
I have a PC running Windows 10 May 2019 Build 18362.
I’m trying to migrate from a small M2 NVME SSD to a larger and faster one. I tried different disk cloning/imaging apps with no luck (True Image, Macrium Reflect, AOMEI Backupper, Paragon Backup & Recovery) to clone the old SSD to the new one.
I was surprised to know none of the apps clones the OEM recovery partitions correctly. On the destination SSD, all OEM partitions become “normal” primary partitions (even with sector-by-sector copy and no-resizing).
This could be the reason OEM recovery no longer works (although Windows works fine) but I’m not certain. Other reason could be wrong BCD info (no idea how a clone could affect BCD, did it update volume-ids?)
My question is how to properly clone these OEM partitions to the new SSD?
Edited: Recovery works again if I connect the old SSD via an M.2 to USB enclosure. This means BCD info somehow point to the partition on the old SSD
OK. I figured it out. It was complicated. Cloning/partitioning apps don't always copy partition type ID and GPT attributes, which cause some recovery partitions become 'normal' partition. Read how to fix this problem here Setting WinRE (Windows Recovery Environment) Flag On Partitions
NOTE: This procedure also allows you to move recovery partitions to a different disk, free up precious space on SSD. If this is what you choose to do, clone 2 recovery partitions (named Image and DELLSUPPORT to the HDD) while keeping the remaining recovery partition in place. The rest of the procedure should be the same. Keep in mind I have not tested this scenario.
The procedure described here is for UEFI boot with GPT disk.
There is a small recovery partition (no name, 839MB for me) next to the Windows partition (C:). Dell OS Recovery relies on this partition. You need to edit a file on it RecoveryLogsReload.xml.
Before you proceed, I recommend to backup all recovery partitions using a imaging program such as Clonezilla.
Step 1: Mount recovery partition: run diskpart.
list disk
select disk X [select the OS disk in question]
uniqueid disk [note down/copy the GUID of the disk, you will need it]
list partition [note down the partition offsets, you might need it later]
list volume
select volume Y [select the recovery volume as stated above]
assign letter=W [choose a drive letter to assign this partition to]
exit
Step 2: Obtain the disk GUID
From the command prompt, run the following command:
wmic partition get BlockSize, StartingOffset, Name, Index
BlockSize Index Name StartingOffset
512 0 Disk #1, Partition #0 1048576
512 1 Disk #1, Partition #1 659554304
512 2 Disk #1, Partition #2 495540219904
512 3 Disk #1, Partition #3 496420327424
512 4 Disk #1, Partition #4 510962622464
512 0 Disk #0, Partition #0 135266304
Looking at the offset you can see the recovery partition we are looking for is 495540219904 because it's next to the biggest Windows partition (biggest gap between partitions). If you have trouble figuring out which partition, calculate the offset against the rounded value you noted down in diskpart ealier (offset / 1024 = KB, offset / 1024^2 = MB, offset / 1024^3 = GB...). Note down/copy the offset value.
WARNING: Mounting recovery reveals it's mostly free, which is suspicious. Some BCD elements points to non-existent files on this partition (for instance in Device object 'Windows Recovery', element named SdiPath value is 'RecoveryWindowsREboot.sdi'). It could be an image partition, in which case, editing a file with a text editor could corrupt some parts of it. To prevent this, an disk/sector editor might be needed, like Sector Edit function from BootIce. Unfortunately, Sector Edit is very basic and it doesn't allow us to find strings so using it for our purpose is tricky. A better program is Runtime's DiskExplorer for NTFS (license needed). Currently, I have no problem with notepad++. I will update this answer again if needed.
Step 3: Edit RecoveryLogsReload.xml
Once you mounted the recovery partition and obtained disk GUID and partition offset, edit the file W:RecoveryLogsReload.xml. If this file doesn't exist, you got wrong recovery partition.
You can do this inside Windows, but you need to enter the full command into the command prompt [running as admin], for ex:
C:Program Files (x86)Notepad++notepad++.exe W:RecoveryLogsReload.xml
It is a bit easier if you use Hiren's Boot PE as it contains everything you need. I don't recommend to use notepad.exe, use notepad++ instead. Hiren's Boot PE will not detect your M.2 NVME SSD in RAID SATA mode, so go to BIOS and set SATA mode to AHCI temporarily as necessary.
In tag , replace the attribute "offset" and "guid" with values you obtained. It's best to convert guid to lowercase as I don't know if it's case sensitive or not. Save the file when you are done.
Step 4: Unmount and testing
Unmount the recovery drive, run: C:> diskpart select disk X [select the previously selected disk] list volume select volume Y [select the recovery volume] remove letter=W exit
Go to BIOS and set SATA mode to RAID again if you set it to AHCI before.
Reboot, press F12 and test SupportAssist OS Recovery. It should now works but if it's still not, double check the offset and guid value again.
EXTRA STEPS
OK, in some cases, you might need to correct the BCD in order to boot or/and using OS recovery. This is due to changing of disk or partition GUID during disk cloning/partitioning process, which causes invalid BCD records.
Don't panic. It can be fixed.
The tool we need is BootIce.
If you can't boot into Windows, use Hiren's Boot PE as it contains everything you need.
Step 5: Mount EFI partition: run diskpart. list disk select disk X [select the OS disk in question] list volume select volume Z [select the FAT32 volume named ESP] assign letter=W [choose a drive letter to assign this partition to] exit
Step 6: Edit BCD files on EFI partition
if you use Hiren's Boot PE:
run BootIce [in UtilitiesBCD-MBR tools]
select BCD tab, in the BCD file section, make sure 'BCD of current system' is selected.
if you can boot into Windows, just download and run BootIce
select BCD tab, in the BCD file section, make sure 'Other BCD file' is selected.
click '...' button and select file W:EFIMicrosoftBootBCD
click 'Professional mode'
go through each entry on the left pane to find any element with value UnknownDevice (usually elements named: *Device), if there is a path associated, use this path to look up the correct volume
if no path is given on *Device, look for the element named *Path or SystemRoot next after it , note down the value
click on this UnknownDevice element to edit it using following rules:
- if the value/path contains 'windows', set it to Windows partition (C:)
- if the value/path contains 'sources', set it to DELLSUPPORT partition
- if the value/path contains 'EFI', set it to ESP partition
- if the value/path contains 'Recovery', set it to Recovery partition
Use the same procedures to edit file W:EFIdellSOSBCD
If you have done everything correctly, SupportAssist OS Recovery should now work.
Answered by trananhtuan on December 21, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP