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 have a dual boot setup with linux and Windows 7 with Grub as the bootloader.

My partition table looks like this:

100 MB System Reserved Windows 7
500 GB Windows 7
100 MB /boot - ext2
500 GB linux, swap, etc.

I'm curious where GRUB installed itself after I had this setup right here.

I thought the System Reserved partition was Windows 7's booting partition, but if Grub rewrote over it (I assume on the master boot record), it seems like Windows 7 would not be able to run.

Where does Grub install itself and still manage to point to both Windows and linux? Does it depend on how you set your partitions?

share|improve this question
    
If you didn't explicitly tell the installer of that distro where to install Grub it should be in MBR now. It also depends whether you installed Windows first or Linux first. For more info, see tinyurl.com/jha3s and tinyurl.com/ycyr2ms –  dZkF9RWJT6wN8ux Aug 10 '10 at 22:30

4 Answers 4

up vote 6 down vote accepted

When Windows installs itself, it puts a bootloader (NTLDR in NT through XP; winboot after that) in the master boot record that reads boot.ini to show you the boot list. Once you pick something from that list, the bootloader's job is done, and the appropriate kernel is started from an actual partition on your drive.

Grub does the same thing; the bootloader is only there to show the grub.conf/menu.lst list, and once you've picked something it transfers control to a regular partition. Thus grub will overwrite the NTLDR/winboot in the MBR, but not anything in a normal partition, and it knows how to transfer control to a Windows partition if you choose Windows from the boot list

share|improve this answer
    
Install Linux 2nd. Is always the key point to remember for an easier life! –  Chris Huang-Leaver Aug 10 '10 at 21:14
    
Yes, I've learned that, Chris. :) –  mouche Aug 11 '10 at 6:38

Grub will install itself to the master boot record of your drive. It's important to realize that the master boot record is the first sector of your partitioned drive, and not a partition itself. See Wikipedia for more information

Given this information, basically Grub will overwrite the MBR information that Windows 7 installed, but it won't touch the "System Reserved Partition" that Windows 7 creates (unless you ask it to). The new MBR will simply tell your system to load GRUB, and then GRUB will ensure that the proper OS is loaded. This makes it easy for you to switch between operating systems.

share|improve this answer
    
So the System Reserved Partition is not on the mbr? –  mouche Aug 11 '10 at 6:40
    
No it isn't. The system reserved partition is a partition that is created by Windows, similar in nature to the /boot partition you have in Linux. That partition and the MBR are two different things. –  Scott Anderson Aug 12 '10 at 15:18

The only time I'd install GRUB to someplace that isn't the MBR is when on a Mac - the whole dual-booting question gets rather more complex there. In the general case, GRUB will be installed to the MBR, overwriting NTLDR, and allowing you to boot Linux or Windows.

share|improve this answer

There are some confusing stuff here. First of all you need to know that there is a "Partition Boot Record" in each slice when disk is partitioned (slice=primary partition). When you format your disk, the first sector is called "bootsector". The bootsector is loaded and executed from the partition flagged as bootable.

GRUB has just 512 bytes in this area, and it's called stage1. Stage 1 just loads stage2 (or1.5), and this is the file that loads the menu.lst file and other modules.

Since Stage1.5 (or Stage2) loads menu.lst from a little amount of code, its filesystem-specific (need to be able to find /boot/menu.lst in your FS).

Take a look here to read more.

In a nutshell: Stage1 is in MBR, but GRUB isn't just stage1, everything but Stage1 is in /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.