Repairing Windows in UEFI mode
Repair boot problems
- Boot with the Windows CD. Be sure to boot the CD boots in UEFI mode (select "UEFI <Your CD-ROM-Drive>" like shown in Windows and UEFI). If you fail to do so it will tell you that the CD is not compatible to your current Windows install (as the CD is in BIOS mode while your Install is in UEFI mode).
- Select your Language.
- Choose the repair option. (Down on the left.)
- You see two popup windows. One is asking to select a Windows Installation. Ignore this.
- The important one is the popup which tells you that some boot problems were detected and can be repaired. Select "Repair and Restart" on this popup. It will take some time and then the machine reboots.
- If after the reboot Windows still does not boot, don't do the above again, now choose the other repair option:
- This time boot into repair options, but deny the automatic repair option by clicking on "No".
- Select your Windows install which is shown in the first Popup and klick "Next".
- Select the first (topmost) repair function, accept everything until it reboots.
- Now Windows should be repaired fully.
- Note that the first start after repair takes a bit longer until everything settles. In future it will boot more quickly.
- If the windows CD is in BIOS mode it cannot read the GPT, such that it cannot detect any Windows. In that case it says that it is not compatible.
- If the windows CD can read the GPT, it usually can detect the restored Windows Partition. (If not it is usually destroyed beyond automatic repair.) It also detects the (currently empty) GPT drive and the (unformatted) MSR partition (but does not tell so).
- The automatic repair rewrites the bootloader data (BCD file) in EFI\Microsoft\BOOT such that it points to all detected windows installations. It also recreates the MSR partition if it is defective.
- The second repair option recreates all the code necessary to boot into windows which might still be missing. This option is a bit more dangerous than the first (automatic) one. It also might reset some of the drivers on the Windows partition, such that those are autodetected on the next boot.
- Now when the UEFI partition and the MSR partition are both filled again with the proper data windows can boot again.
Provoke a repair
Following gives Microsoft a hard time to repair this defect, as it wipes all the bootcodes from the drive. I did this to be able to write this page.
Warning! Do not do this if you use BitLocker or any other drive encryption. Chances are too high to loose all data!
Warning! This section is extremely dangerous! Don't proceed if you do not really know what you are doing. As always: Use at own risk!
This is the plan:
- Start a SysRescCD.
- Nuke all data on the EFI drive
- Nuke the Windows MSR partition
- Then reboot and try the repair from above.
root@sysresccd /root % gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.4
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1465149168 sectors, 698.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 35DD6EC8-EF82-4455-B563-2400C6700080
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1465149134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 8390655 4.0 GiB EF00 EFI System
2 8390656 8652799 128.0 MiB 0C01 Microsoft reserved
3 8652800 218367999 100.0 GiB 0700
4 218368000 1465149134 594.5 GiB 8301 Linux reserved
root@sysresccd /root % mount /dev/sda1 /mnt
root@sysresccd /root % rm -rf /mnt/EFI
root@sysresccd /root % umount /mnt
dd: writing to `/dev/sda2': No space left on device
262145+0 records in
262144+0 records out
134217728 bytes (134 MB) copied, 3.61339 s, 37.1 MB/s
Move Windows from BIOS to UEFI
Well, the usual warning section applies here, too: Use at own risk. This one is not that dangerous, as unplugging a drive makes it inaccessible, such that you cannot destroy it by chance. However things always can go wrong, so if you break it you are solely responsible for that.
- You have Windows install in BIOS mode.
- You prepare a new drive as given in Prepare GPT disk (which probably gets a bigger windows data drive)
- You want to run Windows from this new disk
- You have Acronis True Image - note that I do not want to advertise for a commercial product, but it's simply so that I do not know how to do this without it. Besides that it is really a good and reliable backup tool, it always worked reliably and stable and exceeded my expectations. (But I always know what I am doing. It is probably not such good for people without any plan.)
- The nice thing by doing it via backup/restore is that you can resize (shrink) your C: partition, beyond the bounds given by Windows this way.
- Shutdown the computer.
- Put both drives into the computer. Note that the old drive is the first and the new one is the second drive in my case.
- Unplug the first drive (the one with your Windows Install) such that only the second one is there.
- Prepare the second drive as shown in Prepare GPT disk. Set up all 3 partitions (EFI, MSR, Partition which becomes C:)
- Shutdown the computer.
- Plug in the first drive again.
- Start Acronis.
- Let it backup Windows. Note that this can be done without installing Acronis onto Windows if you have no Drive Encryption (like Bitlocker or TrueCrypt) installed.
- Shutdown the computer.
- Unplug the first drive again, such that Windows is safe.
- Start Acronis again.
- Let it restore Windows into the new parition on the second drive. (This way I cannot accidentally harm the first drive.)
- Shutdown the computer