LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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?

Notices

Reply
 
Search this Thread
Old 02-22-2013, 11:00 PM   #1
jdtiede
Member
 
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 ibackup.com. 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
descendant_command
Member
 
Registered: Mar 2012
Posts: 757

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

Rep: Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985
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
sulekha
Member
 
Registered: Dec 2004
Location: India
Distribution: ubuntu 10.04 , centos 5.5 , Debian lenny, Freenas
Posts: 324

Rep: Reputation: 36
Lightbulb

Easiest way is as follows , get a copy of system rescue cd http://www.sysresccd.org/SystemRescueCd_Homepagethen 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
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,187

Rep: Reputation: 530Reputation: 530Reputation: 530Reputation: 530Reputation: 530Reputation: 530
When you get it up & running, do the following to put backups in /boot
Quote:
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
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 158

Rep: Reputation: 23
Quote:
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.
 
  


Reply


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 10:33 AM.

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