0

I am trying to partially restore a previous system image with a slightly different partition table and Windows 10 keeps trying (and failing) automatic repair.

I need help fixing the partition table.


Setup Background


I will denote the "current" (i.e. layout before restoring backup images) as layout A. Layout A partition table is as follow (sector size: 512):

DEVICE     START          END     SECTORS     SIZE     TYPE
A-P1        2048      1023999     1021952     499M     Windows Recovery Environment
A-P2     1024000      1228799      204800     100M     EFI System
A-P3     1228800      1261567       32768      16M     Microsoft Reserved
A-P4     1261568    625827839   624566271     298G     Microsoft Basic Data
A-P5   625827840   2000406527  1374578688   655.5G     Microsoft Basic Data

Note that A-P4 and A-P5 are encrypted with Bitlocker in layout A.

I will denote the backup images I am attempting to restore as layout B. The original system from which backup B was created had a smaller, B-P4 and consequently, larger B-P5 relative to layout A. However, B-P5 is a full of user data (no OS data) and therefore B-P5 was not backup and and the current A-P5 will be preserved. Below are the images I have available to restore:

 FILE                      SIZE
 B-bs=512_count=2048.dd    1,048,576
 B-P1.dd                   523,239,424     (same size as A-P1)
 B-P2.dd                   104,857,600     (same size as A-P2)
 B-P3.dd                   16,777,216      (same size as A-P3)
 B-P4.dd                   267,349,131,264 (SMALLER than A-P4)

Since I do not want to change the boundary of A-P5 since I want to preserve its (bitlocker encrypted) data, I did not restore the first 2048 sectors of the disk. Instead I used GParted to change the B-P4 end boundary to reflect the B-P4.dd file size. Accordingly, the partition table looks as follows:

DEVICE     START          END     SECTORS     SIZE     TYPE
B-P1        2048      1023999     1021952     499M     Windows Recovery Environment
B-P2     1024000      1228799      204800     100M     EFI System
B-P3     1228800      1261567       32768      16M     Microsoft Reserved
B-P4     1261568    523427839   522166272     249G     Microsoft Basic Data
A/B-P5 625827840   2000406527  1374578688   655.5G     Microsoft Basic Data

I then restored B-P1, B-P2, B-P3, and B-P4, with files, B-P1.dd, B-P2.dd, B-P3.dd, and B-P4.dd, respectively. Also, note that the restored B-P4/B-P4.dd is not encrypted.

Once restored, I was able to mount, mount B-P4 /mnt, the unencrypted Windows OS partition with success.


What I Tried


I tried to fix the partition table in Windows Advanced Repair Command Prompt as follows:

  1. bootrec /fixmbr (success)
  2. bootrec /fixboot (fail / "access denied")
  3. DISKPART: assign letter to EFI partition (letter N:)
  4. Format N: to FAT32
  5. bcdboot d:\windows /s n: /f uefi (failed / not in windows store)

I stopped here before doing real damage. I reimaged the EFI partition B-P2.


Other "useful" Information


The B backup layout I am restoring is Windows 10 1804. The A layout was for Windows 10 20H1. I am in the process of creating a USB recovery drive from another Windows 10 20H1 computer that I will have at my disposal.

If not already apparent, I have access to Ubuntu Live and the images were created/restored using Ubuntu.


Parting Thoughts


How can I fix the partition table so that B-P4 (unencrypted) boots to Windows while preserving the boundaries of the (bitlocker encrypted) A-P5 partition?

1 Answer 1

0

So, I rolled the dice with the following and it seems to have worked.

  1. Restored first 2048 sectors with backup image, B-bs=512_count=2048.dd
  2. Restored P1 - P4 with respective backup images
  3. In fdisk, deleted A-P5 partition (since it wasn't correctly aligned after restoring first 2048 sectors of backup image)
  4. In fdisk, created new P5 with correct boundaries for A-P5

After that, I rebooted and Windows loaded normally. I was also able to mount the bitlocker encrypted A-P5 partition and it appears to have been unaffected.

I should not that I also had a backup of the A disk in case I needed to start over. I would always recommend a complete backup before screwing around with restoring old images. Having that backup is the only reason I risked deleting and re-created A-P5 boundaries (as I personally lack expertise level knowledge on how MBR/UEFI partition tables work).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .