Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Please excuse the length on the question; this is a bit tricky to explain.

I have two SATA hard drives in my HP dc7100CMT, and their sizes are 500GB and 160GB. In the larger drive, I have Windows XP Pro 64-bit and Windows 7 Pro 64-bit, in two partitions respectively.

In the second (160GB) drive, I installed Fedora 20 64-bit and formatted it into four partitions: boot, data, swap, and root (in that order). I also installed the GRUB2 boot-loader to the "/boot" partition. However, when I turn on my PC, after the POST messages clear, the system boots into the first hard drive, as it has always done before. (Windows 7's boot loader is called and asks me If I want to load XP or 7 - This behavior should have changed after installing Linux.)

When I check my BIOS, I have no options of changing the boot device (For multiple SATA drives, it starts the drive on SATA-0 by default and that cannot be changed). The other constraint is that I cannot change either of the Windows partitions on the first drive (and the drive has no unallocated space to install a new partition).

This leaves me with two options:

  1. Install GRUB2 to my Windows drive (preferred - if possible)
  2. Physically change the drive order connected to the motherboard (really want to avoid doing this)

My question is, how can I try option 1 (or something similar)? If not, is there another way?

share|improve this question
Install the operating systems in order. If you want Windows XP, Linux, and Windows 7. Install them in that order. After you install the last operating system you will have to "repair" Grub. – Ramhound Jan 29 '14 at 5:27
@Ramhound I said I can't do that; I cannot reinstall Windows - that's the constraint. Plus, I DID install them in the order I want, with Linux on a separate drive. It's just the bootloader I CAN change. – yuki96 Jan 29 '14 at 16:05
You didn't but limits on what your options were, you want to acheieve option 1, I provided you a way to do that. – Ramhound Jan 29 '14 at 17:11
@Ramhound I appreciate the help, but I needed something like terdon's answer since overwriting the bootloader is what I intended to accomplish; sorry if I wasn't clear. – yuki96 Jan 29 '14 at 17:26
It's bit to late to make yourself clear – Ramhound Jan 29 '14 at 18:07
up vote 4 down vote accepted

You need to boot using the Fedora install CD and from there install GRUB to the widows drive. This will delete the windows bootloader but you will still be able to load windows through grub.

When you've booted into the Fedora live session, you will have to mount your local drives and set up a chroot environment. There is a very good answer on how to use chroot here but the basic procedure is:

  1. Create the necesseray directories

    sudo mkdir /mnt/boot /mnt/root
  2. Mount your local Linux system (change the device ames accordingly)

    sudo mount /dev/sdb3 /mnt/       ## the / partition
    sudo mount /dev/sdb1 /mnt/boot   ## the /boot partition
    sudo mount -t proc proc /mnt/proc
    sudo mount -t sysfs sys /mnt/sys
    sudo mount -o bind /dev /mnt/dev
  3. Set up the chroot

    sudo chroot /mnt

Now, create grub's configuration file. If you're using a Red Hat-based system (like Fedora) run

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

For Debian-based systems, run

sudo update-grub

That's just a shell script that runs the grub2-mkconfig command above but also includes set -e for safety (it will exit immediately on any errors).

Make sure the output of that command lists both your Windows systems. There should be lines like

Found Windows 7 (loader) on /dev/sda1
Found Windows XP (loader) on /dev/sda2

If grub has seen your other OSs correctly, install it to your 1st hard drive. For Red Hat based systems run:

sudo grub2-install /dev/sda

And for Debian based:

sudo grub-install /dev/sda

Finally, exit chroot and reboot:

sudo reboot
share|improve this answer
I tried your answer, however sudo update-grub says "update-grub" is not valid. I tried with "update-grub2", but that was also invalid. – yuki96 Jan 29 '14 at 16:12
@abckookooman sorry, I had forgotten you mentioned Fedora. Try the updated answer. – terdon Jan 29 '14 at 16:19
+1 Your answer worked like a charm. However, I only had to use the last two lines, since fedora automatically sets up chroot ;) However, GRUB loads windows 7 bootloader. If I have to access windows, I have to go through GRUB and windows there a simple way to add an entry in grub.cfg? – yuki96 Jan 30 '14 at 2:00
@abckookooman probably yes, but please post a new question for follow up issues. – terdon Jan 30 '14 at 2:07
Damn your good. – Damon Jan 30 '14 at 9:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.