Recover mbr

Hello everyone.
I would like to recover my grub installation in a dual boot system. Could you please tell me if there is an easy way to recover grub using flash disk?
If yes is your suggestion opensuse developed? (currently running 11.3) . It would be nice also to have some gui just to make things easier. If not I assume that then the only option is the boot from dvd. Is that right?

Regards
Alex

Take a look at this thread and see if it does answer some questions:
Re-Install Grub Quickly with Parted Magic
You might be able to get PartedMagic on a flash disk.

Hi,

Yes, Parted Magic will do the trick.

Just to verify that did that (parted magic live) and worked fine. Thanks a lot

Reference the MBR, I note it is often prudent BEFORE a Linux install to back up the MBR BEFORE the Linux install.

One of the members are our office Linux Users Group (LUG) pointed out this interesting “dd” command method to backup the MBR to me (below):

In the example given, we are assuming the first hard disk is /dev/hda. In the newer systems, IDE drives, SCSI drives and USB drives/sticks are considered as SCSI devices, so the first drive is /dev/sda, thus the commands are:

Backup MBR (as root):

dd if=/dev/sda of=MBR-backup bs=512 count=1

and then store the file “MBR-backup” someplace (such as on a memory stick).

It is very important to get that command EXACT (ie do NOT reverse content of “if” and “of”). The idea of the backup being if one breaks the boot, then with another dd command one can restore the MBR.

Restore MBR (as root, WARNING!)

dd if=MBR-backup of=/dev/sda bs=512 count=1

Its very simple but it is INCREDIBLY IMPORTANT that one makes no errors in the dd command, as the consequences could be unpleasant.

Please also note, that if you have changed your partition layout and wish to only restore the boot loader (and not the partition table as well) then restore with

dd if=MBR-backup of=/dev/sda bs=446 count=1

note “bs=446”

On 2010-11-20 12:06, oldcpu wrote:
>
> Reference the MBR, I note it is often prudent BEFORE a Linux install to
> back up the MBR BEFORE the Linux install.

> Code:
> --------------------
> dd if=/dev/sda of=MBR-backup bs=512 count=1
> --------------------
>

Be warned that this stores also the partition table. If you partition your
system (you are installing linux, so you will) and then restore this way,
your partition table will be changed back to the previous state and linux
will be “destroyed”.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Be warned that this stores also the partition table. If you partition your
system (you are installing linux, so you will) and then restore this way,
your partition table will be changed back to the previous state and linux
will be “destroyed”.

This is the reason for

note “bs=446”

For that matter, it is the reason for my post, was I not clear with my explanation?

A final word, ! If in doubt always restore using “bs=446” , If you need “bs=512” you should already know why!

On 2010-11-20 14:06, dvhenry wrote:

>> your partition table will be changed back to the previous state and
>> linux will be “destroyed”.

> For that matter, it is the reason for my post, was I not clear with my
> explanation?

Yes, but it arrived here after I sent mine. Both your post and mine are
timestamped “13:06”.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Yes, but it arrived here after I sent mine. Both your post and mine are
timestamped “13:06”.
I didn’t realise that, but looking at it now, the extra clarification is a good thing anyway!
A mistake with this could be costly, or at least painful. Having said that, it’s a worthwhile precaution if done correctly.

On 2010-11-20 22:36, dvhenry wrote:
>
>> Yes, but it arrived here after I sent mine. Both your post and mine are
>> timestamped “13:06”. I didn’t realise that, but looking at it now, the extra clarification
> is a good thing anyway!
> A mistake with this could be costly, or at least painful.

Very much so if you are a newbie…


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

I decided to finally stop being lazy, and I’m proceeding to create a backup copy on each of my PCs of the MBR with and without the partitioning.

So with root permissions I am running:

dd if=/dev/sda of=MBR-backup-512  bs=512 count=1

dd if=/dev/sda of=MBR-backup-440  bs=440 count=1

and I am keeping a copy of MBR-backup-512 and MBR-backup-440 on each PC (as each PC’s is different).

Edit - fixed typo

Edit2 - corrected from 446 to 440

Actually, If you intend to save the full partition layout, you may want to use a command like,

sfdisk -d /dev/sda > part_layout.txt

and restore with

sfdisk /dev/sda < part_layout.txt

as the above “dd” command only saves the needed info for the primaries (including the extended) but not all that may be needed for your logical partitions.

I had this bug report pointed out to me on IRC, of a hiccup when using ‘446’ in the dd command:
https://bugzilla.novell.com/show_bug.cgi?id=396444#c61

and to quote the posts:
Steffen Winterfeldt 2008-06-07 12:16:12 UTC

I note I’ve sucessfully used 446 with win7 and winXP, but never with Vista. I’ve never tried it with Vista.

Interesting, and begs the question, Isn’t it easier/safer to repair or reinstall a boot loader?

I need to correct my statement on this - I’ve only successfully used 446 with Linux and winXP and NOT with win7 nor Vista. I had thought I had used it with win7, but when I checked my notes as to what I actually did that day, it was NOT with win7 that I used the dd command.