Take the 2-minute tour ×
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
2  
as simple as possible: do not install windows. –  lesmana Mar 20 '13 at 17:34
1  
Related: How to recover grub after Windows installation –  Gilles Dec 26 '13 at 20:50

3 Answers 3

up vote 3 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 '13 at 18:07
    
@Nathan2055 Yes, like 7 to 8... new, higher versions of Windows. Windows Update will not affect the MBR. –  Christopher Mar 20 '13 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 '13 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 '13 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 '13 at 14:51

I think I will go with a vanilla GRUB setup and not mess with the bootloader.

If you use any form of grub, you are messing with the boot loader. GRUB stands for "grand unified bootloader". And there are two versions -- grub v1 adn grub v2. All modern linux systems use grub2 automatically. If you install any linux system, grub is the default bootloader unless you specifically go with LILO, which I would not suggest.

I personally have a dual boot system with xp and Wheezy. I keep xp from over writing grub by disabling "windows restore" option.

Before I disabled the restore option, I would have to fix grub at least once a week as windows bootloader kept overwriting grub.

I am fixing to install windows 8 on an external hard drive through a usb port. I am hoping this goes without a hitch and doesn't mess with my mbr.

share|improve this answer

Just open gparted , right click the partition that has Grub in it, go to manage flags and mark boot.

share|improve this answer

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.