Using GRUB to boot multiple operating systems, the correct way
Often when you want to use more than one Operating System on your computer, you run into GRUB issues.
When you install an OS, or upgrade an installed OS, problems can occur when the new install overwrites your GRUB setup, leaving you with unbootable OS's. It is possible to correct these issues, but that is an annoying exercise that you will have to repeat every time you update stuff.
In order to solve this issue for once and for all, the solution is to make 1 partition the 'master GRUB' partition. This GRUB will contain only so called 'chainloader' commands, pointing to all the 'child' partitions containing the OS's. Those partitions will contain the GRUB's from those OS's. So we create a 2 stage boot process:
In this scenario let all the OS's manage their own partitions, and THIS IS IMPORTANT: don't let them update our 'master GRUB' partition. They can update their own GRUB during updates etc.
Note that the 'grub-install' method has the added protection of not inadvertantly overwriting your partition table if it had been modified since your last MBR backup.
This is because the 512byte MBR sector is actually two parts:
- The first 446 bytes is the grub stage1 bootloader (or the windows bootloader after you’ve reinstalled windows and it “helpfully” overwrites grub).
- The last 64 bytes is where your partition table is stored.
So, if you only want to backup the bootloader in the MBR, remember to change the bs=512 to bs=446.