Windows moved the bootloader to another drive

0

0

I have a dual boot install. I first installed Windows 7 in its own disk (C:) with the secondary drive disconnected. I did this because I know Windows has a tendency to mess with other drives. Then I connected a secondary drive and created a data partition (D:) and installed Linux in a third partition.

To sum up:

  • Disk 1: Windows partition (C:)
  • Disk 2: Data (D:), Linux (invisible from windows due to filesystem), swap.

When Linux installed itself, it also installed GRUB in the second disk (BIOS, not UEFI). So the Windows bootloader, which was installed in C:, wasn't used. Still if in case of an emergency I disconnected the second disk or it failed, Windows 7 bootloader worked.

This has been working fine for years.

Now as part of a Windows Update this month, and I presume it is related to that update that nags you with the end of support message and a possible upgrade to Windows 10, Windows 7 has moved its own bootloader from C: to the data partition in the secondary disk (D:). There is now a bootmgr.exe and a Boot folder in D:, and there is none in C:.

Dual boot via GRUB is still working fine though, but I would like Windows' own bootloader to stay in C: where it belongs. Will it suffice with copying bootmngr.exe and the Boot folder back to C:, or should I use Windows installation DVD to "repair" the Windows install? And If I fixed that disk alone, would the GRUB in the secondary disk still work?

UPDATE: (Dec 2019) It has happened again! I installed a security cumulative package and apparently Windows decided that the SSD where it was installed is no good and moved itself to the other hard drive.

Mister Smith

Posted 2019-04-01T07:05:24.860

Reputation: 575

Answers

0

UPDATE I disconnected the second disk, restarted, and windows booted into repair mode instead of normally. I chose "startup repair" but it didn't work. It said windows couldn't repair automatically. The error detail shown was something like "NoOsLoader". I inserted the original Windows installation DVD and restarted the PC. In BIOS it said "press any key to boot from DVD", so I did that and booted from DVD. Selected timezone and keyboard, then chose "startup repair" again, and it fixed the missing bootloader without having to perform a full reinstall. Now windows restarted again and this time it could boot from C: normally. During all this time the secondary HDD was disconnected (both power and data cables) for just in case windows repair utility decided to mess with this disk instead. After repair was confirmed sucessfull, I connected again the other hdd and booted into linux. I inspected the D: partition and I found some files that were not there before and were created by windows recently:

/boot
bootmgr.exe

So that was definitely the cause of the problem. Windows HAD MOVED ITS OWN BOOTOADER TO A PARTITION OF HIS CHOICE.

I deleted those files as they were already reinstalled into C: where they belong.

Now to prevent this from happening again I have 2 choices:

  1. Never ever install "security" updates again, as they clearly mess with the bootloader.
  2. Disable the D: partition in windows.

Mister Smith

Posted 2019-04-01T07:05:24.860

Reputation: 575

0

This is an issue I experienced about a year back, I was attempting to install windows on a second drive to facilitate the migration of data from an old HDD to a new SSD. During installation, whether it be a bug or by design, Windows will detect boot-loaders on other disks and install itself there. I was unable to, by any measure, get the boot-loader on the correct disk and all attempts to remedy was met with blue screens or a tidy "no OS found" message.

Your best bet would be to try to repair windows with an installation disk/USB with your linux disk disconnected. While it's probably possible to move the file(s) over, I don't recommend it as Microsoft likes to create associations which may make your life miserable.

Alexander Wryn

Posted 2019-04-01T07:05:24.860

Reputation: 41

But let's say I manage to restore windows bootloader in C:. When I connect back the other disk, and since it comes first in boot order in the BIOS, will GRUB be able to boot Windows in C just as before? – Mister Smith – 2019-04-05T12:48:05.470

0

The problem is delicate, since the Windows 7 boot process is quite fragile.

In theory, it is possible to copy the System Reserved partition that contains the Boot folder from D to C, but there are some gotchas:

  • The Windows 7 partition must stay in its exact sector address, or the boot process will not work. If you will move it in order to free disk space, it may become unbootable.

  • After copying the System Reserved partition from D to C, the command to set the BCD is:

    bcdboot c:\windows /s c:
    

    and it must be issued from inside Windows, so you must boot from grub, and it's unclear which BCD Store will be updated. If it's the one on D, then you may need to boot Windows 7 from USB into the Command Prompt and issue this command using the right volume letter and with the Linux disk disconnected.

Before starting, I suggest taking some precautions:

You might be able to short-circuit some of the above precautions, but you will then need to have some luck on your side.

harrymc

Posted 2019-04-01T07:05:24.860

Reputation: 306 093

But the DATA partition in the secondary disk (D:) is not system reserved! It is a regular NTFS partition and I have it filled with my own personal data (which is why I freaked out) – Mister Smith – 2019-04-05T12:41:14.060

Also nothe that GRUB's regular bootloader is installed in this very same secondary disk since always, and it is still working. So I'm guessing windows fucked up while trying to install its own bootloader in this disk and just copied a bunch of files in there. These windows boot files are probably not located in specific sectors or anything, since this is a large data partition. – Mister Smith – 2019-04-05T12:45:51.407

Questions: (1) Are you using BIOS or UEFI? (2) Do you see any System Reserved partition on D (not DATA)? (3) Do you have such a partition on C, or has it become unused space (meaning Windows Update has deleted it)? – harrymc – 2019-04-05T13:43:01.770

I'm using good old BIOS. There should be no new system partition in D, since I manually partitioned it and there is no free space available. There is the DATA partition, a linux ext partition and a linux swap partition. I've no idea of what has happened to C:, but there should be a single Windows partition. I'll check when I get home. – Mister Smith – 2019-04-08T08:20:54.573

If you have no System Reserved partition on D, then there is nothing to copy. If there is enough space for it on C, then bcdboot should be able to create it from scratch. If all fails, you will need to disconnect drive D and do Startup Repair.

– harrymc – 2019-04-08T09:08:17.810