Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've been reading a lot about dual-booting, and it seems as easy as loading Windows and then loading Linux with GRUB, but everybody says that Windows loves to trash GRUB when it gets the opportunity. What are some steps I can take to prevent this from happening (other than using Windows' bootloader, I want to keep this as simple as possible)?

share|improve this question
1  
as simple as possible: do not install windows. – lesmana Mar 20 at 17:34

1 Answer

up vote 2 down vote accepted

Windows will overwrite the boot sector whenever you install it, upgrade it to a new version, or use tools like bootrec /fixmbr, bootrec /fixboot, or the older fdisk /mbr. In general, install Windows first, then Linux. The boot sector will stay put until you do one of the things above. (And perhaps there are also other ways to write onto the MBR.) But, if you lose GRUB, it is easily restored:

  • Boot from a live CD (CD/DVD or flash drive).
  • Become root or use sudo with commands below.
  • List the available partitions if needed: fdisk -l
  • Windows will almost certainly exist on /dev/sda1: mount /dev/sda1 /mnt
  • Reinstall GRUB in the MBR: grub-install --root-directory=/mnt/ /dev/sda
  • Reboot: shutdown -r now
  • Restore the GRUB menu: update-grub

You could also install 100% Unix, Linux, or BSD and simply run Windows in a virtual machine if the computer is strong enough for that.

Also: your computer's BIOS may have an option to protect the boot sector.

share|improve this answer
By upgrading, do you mean Windows 7 to Windows 8 or just running Windows Update? – Nathan2055 Mar 20 at 18:07
@Nathan2055 Yes, like 7 to 8... new, higher versions of Windows. Windows Update will not affect the MBR. – Christopher Mar 20 at 18:08
I thought so. The good thing is I doubt I will be messing with the MBR under Windows, and there is no way I am going to Windows 8 after reading this. – Nathan2055 Mar 20 at 18:13
As an alternative, you can try to configure the windows bootloader to chainload to grub: oreillynet.com/pub/h/2337 A little more involved and may be too much work for too little effect, but doing it that way makes it so if Windows does overwrite the bootloader, you'll still be able to boot into Linux. – Joel Davis Mar 21 at 12:46
@JoelDavis: Yeah, I've read several tutorials on doing that, but for someone who has absolutely no experience even loading GRUB and the fact that I don't think Windows will give me trouble, considering I don't want to upgrade, I think I will go with a vanilla GRUB setup and not mess with the bootloader. – Nathan2055 Mar 21 at 14:51

Your Answer

 
discard

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.