Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 02-22-2013, 11:00 PM   #1
Registered: Apr 2003
Location: Baton Rouge, LA
Distribution: Kubuntu 12.04, 12.10, 13.04a
Posts: 244

Rep: Reputation: 30
How can I rebuild a Linux MBR which was wiped out by XP?

I had a response that said look for grup/stage1, but in the new grub the only file is grupenv, and it is not human sensible. This is Kubuntu 12.11. I can't quite get a handle on using perhed for this. There is one 465Gb partition with two Linux OS files, representing 121.04 and 12.11, I think. There is a smalles part that works normally. When XP got thru with it, the big part. was shown as a Win type (FAT322 or NTSF, can't remember which). I got it back to ext3 op 4 with smarttools. Most of it was backed up to the other computer, USB stick, or Then the USB stick failed with very little warning. I think I'm o.k. but even so I want to be able to use the rest of that disc again.
Old 02-22-2013, 11:30 PM   #2
Senior Member
Registered: Mar 2012
Posts: 1,025

Rep: Reputation: 234Reputation: 234Reputation: 234
Boot from a repair disk (install disk or SuperGrub2Disk or such) and reinstall grub to mbr.
Old 02-23-2013, 02:40 AM   #3
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 13,253

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Go here, and do as it says. The output will tell us what your boot environment is and how to offer proper advice.
Old 02-23-2013, 11:26 AM   #4
Registered: Dec 2004
Location: India
Distribution: ubuntu 10.04 , centos 5.5 , Debian lenny, Freenas
Posts: 324

Rep: Reputation: 36

Easiest way is as follows , get a copy of system rescue cd boot from CD/DVD drive using system rescue CD , then you will get the option for BOOT AN EXISTING LINUX PARTITION ,choose it. after you have booted into linux go to package manager and search for grub or grub2 depending on your distro and then simply re-install it

Last edited by sulekha; 02-23-2013 at 11:28 AM.
Old 02-25-2013, 01:26 PM   #5
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,980

Rep: Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630
When you get it up & running, do the following to put backups in /boot
dd if=/dev/sda of=/boot/sdambr bs=512 count=1
dd if=/dev/sda1 of=/boot/sda1mbr bs=512 count=1
Then when windows overwrites, just boot anything unix and copy them back.
Old 02-28-2013, 07:49 AM   #6
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 158

Rep: Reputation: 23
Originally Posted by business_kid View Post
When you get it up & running, do the following to put backups in /boot
dd if=/dev/sda of=/boot/sdambr bs=512 count=1
dd if=/dev/sda1 of=/boot/sda1mbr bs=512 count=1
Then when windows overwrites, just boot anything unix and copy them back.
WARNING: that's assuming alot. First of all, the GRUB code is about 29KB for GRUB2 (smaller for GRUB-legacy). Never fits into 512 bytes. Although, it might be enough if the "destroyer" was Windows which puts more bootloader stuff into the system partition, i.e., it might have overwritten only 512 bytes indeed. *Might have*. A bit more uncommon on Linux installations because you usually install GRUB to sda, not sda1.

Second, tell the OP that you assume that "sda1" is what you believe to be his/her root partition, or more precisely, what the OP has originally specified to write to using "grub-install".

And eventually, this MBR backup stuff isn't explained in one sentence. It is a low-level operation which needs some knowledge in the first place. What if "sda1" is not marked bootable and already starts with the partition superblock in that very first sector, but then, that sector has changed over the last months and then you come and restore an old sector copy the hardcore way? Oha.

There is no real problem using this DD/MBR stuff - as long as you *exactly* know what you're doing. Giving such kind of advice to someone who asks, especially with a one-liner ala "do this and be happy" is dangerous.. no offense..

Last edited by bloody; 02-28-2013 at 07:53 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
replace wiped mbr uriah Linux - Newbie 6 10-18-2006 11:43 PM
windows wiped my MBR garba Linux - General 2 05-15-2005 02:11 PM
Rebuild EXT2 FS - Installer wiped it (??) facets Linux - Newbie 2 06-26-2004 06:53 AM
Rebuild EXT2 FS - Installer wiped it (??) facets Linux - General 0 06-26-2004 06:43 AM
help - MBR wiped out linuxify Linux - General 10 03-21-2004 02:01 PM

All times are GMT -5. The time now is 05:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration