GRUB, like all boot loaders, uses the MBR to pass control to the actual loader software. In GRUB's case, the MBR part is called "Stage 1," and it reads the HD to find the location of "Stage 2" to which it then pases control. Windows XP does, essentially, the same thing, although control is passed to "ntloader" which is, I think, expected to be in the sector right after the MRB.
Anyhow, the point is that the loader is partially in the MBR, and partially not.
If you're reinstalling an OS, what you need to do depends on the OS installation. Most Linux distributions will not change the MBR unless you tell them to do so. Windows installations will, I think, almost always overwrite the MBR.
A simple solution if you need to reinstall, e.g., Windows XP is to copy the MBR into a file in the Windows root directory, and add it to the "boot.ini" file so you can run it when XP kills your MBR.
For example, here's what my XP "boot.ini" file looks like:
Code:
$ cat /mnt/WinXP/c/boot.ini
[boot loader]
timeout=5
default=C:\linux.bin
#default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP" /noexecute=optin /fastdetect
C:\linux.bin="Linux"
If you've got a floppy drive, or a USB drive, you can make either one GRUB bootable, and keep them around as a back-up boot drive so you can boot into Linux even after the HD MBR gets rewritten. Then you can use the GRUB command to re-install GRUB in the MBR.
Bottom line: there's several different ways to address the problem. Use the forum search tools to find one you like.