How to restore MBR on a separate /boot partition?

Bill Davidsen davidsen at tmr.com
Tue Apr 9 17:29:01 UTC 2013


Dan Thurman wrote:
> On 04/08/2013 09:06 AM, Dan Thurman wrote:
>> Since I was unable to install F18, I would like
>> to revert back to F17 that I have restored from
>> backups, the following partitions:
>>
>> / (root)   /dev/sda10
>> /boot      /dev/sda9
>>
>> What I have left to do is to restore the MBR
>> on /dev/sda9 /boot partition.
>>
>> I have a separate MBR installed on /dev/sda
>> drive which is the master MBR for multiboot
>> OS, which is working fine.
>>
>> What steps can I use to accomplish this?
>>
> Are these the instructions I am looking for?
>
>     1. Boot the system from an installation boot medium. (live CD/DVD/USB)
>     2. Type linux rescue at the installation boot prompt to enter the
> rescue environment.
>     3. mkdir /mnt/sysimage
>     4. mount /dev/sda10 /mnt/sysimage
>     5. mount /dev/sda9 /mnt/sysimage/boot
>     6. mount --bind /dev /mnt/sysimage/dev
>     7. mount --bind /proc /mnt/sysimage/proc
>     8. mount --bind /sys /mnt/sysimage/sys
>     9. chroot /mnt/sysimage              # root partition.
>    10. grub2-install /dev/sda9           # boot partition.
>    11. grub2-mkconfig -o /boot/grub2/grub.cfg
>    12. Review the /etc/grub.d/10_linux
>    13. Reboot the system.
>
A few comments on this:

1 - I am not an expert, I think "experienced" would be a better description.

2 - Google "grub2 install MBR in partition" and note that it has not been 
uniformly successful. That's my experience, with MBR data not in the MBR part of 
the disk you are essentially chain loading grub2, and your BIOS and misc other 
factors may cause this to fail, solidly or when the mood strikes it. That was my 
experience, and other users' as well. There, I warned you.

3 - your setup looks as good as it gets, I can't see anything wrong, several 
posts suggested copying resolv.conf to the chroot etc directory, I don't know 
why, but several posts said it was needed. I suspect it depends on your setup.

4 - I assume there's a good reason to do it this way instead of just putting the 
MBR in the MBR area, but you are traveling some code which has failed for 
others. You might consider doing things the more typical way.

5 - I would do grub2-mkconfig and put the result in a temp file, then look at it 
hard before proceding. I don't think you need all the mount stuff, since you 
will bind /dev to /chroot/dev anyway.

6 - good luck.

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot


More information about the users mailing list