LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-04-2010, 02:25 PM   #1
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
Did I damage partition table? How?


Edit:
I know now: I overwrited the mbr with a totally wrong one, and I have no backup

So far as I can recall, I had two primary partitions; the first one for xp, and there were several logical volumes for linux in the second primary partition).
None of these partitions are found now, grub reports "Error 22" with the wrong mbr.

Can the mbr be corrected/recovered somehow, in a way that all of the original partitions show up again?
I think, the partitions themselves are not damaged, since only the mbr was overwritten.

I suppose a fixmbr command from the recovery console of the xp installation CD would fix the mbr and make the xp system in the first primary partition bootable. Am I right? How about the second primary partition; would fixmbr find that too? (Sorry for the silly questions, but I do not want to commit more mistakes, especially irreversible ones.)

Last edited by J_Szucs; 07-04-2010 at 03:59 PM.
 
Old 07-04-2010, 04:14 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by J_Szucs View Post
Can the mbr be corrected/recovered somehow, in a way that all of the original partitions show up again?
MBR and PT are two separate things. 'testdisk' can recover your Partition Table and can write a Master Boot Record.
 
1 members found this post helpful.
Old 07-04-2010, 05:29 PM   #3
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
According to the wiki(http://en.wikipedia.org/wiki/Master_boot_record), the mbr has a "Table of Primary Partitions" at hex address 01BE: four 16-byte entries. That is what I damaged by overwriting the mbr with a wrong one.

In the meantime I run fixmbr from the xp installation CD, and now I can boot into xp. But it did not find and register the second primary partition in the mbr. Though that starts immediately after the first primary partition (which it has found), and stretches to the end of the disk...

I have testdisk on the linux system, but that is not accessible now. All what I have is an ancient knoppix-based System Rescue CD, and the xp system that is working again . I think it would be easier to find some windows tools, to analize the disk, and find and register the second primary partition in the mbr.

By the way: what if I would create the second primary partition by fdisk? Would it only register it in the mbr, or would it create a blank partition table for it; meaning that its existing logical volumes would be deleted?

Last edited by J_Szucs; 07-04-2010 at 05:42 PM.
 
Old 07-04-2010, 05:43 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
As far as I know the MBR of every operating system never dare to touch the partition table. The boot code is restricted from the 1st to the 446th bytes and the last two bytes may also be used as a counter or magic number. In between lies the 4x16 bytes partition table.

No operating system I know of "dare" to trash an existing partition table. It would simply be treated as an outcast because every operating system needs it to operate.

Post here the output from a root terminal to demonstrate the claimed damage.
Code:
fdisk -l

Last edited by saikee; 07-04-2010 at 05:44 PM.
 
Old 07-04-2010, 06:35 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by J_Szucs View Post
I think it would be easier to find some windows tools, to analize the disk, and find and register the second primary partition in the mbr.
You're still confusing the MBR with the PT. Anyway, there's a D/L for photorec/testdisk you can install and use on your mcrsft.
 
Old 07-04-2010, 07:04 PM   #6
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
Oops, I found testdisk on the System Rescue CD. Thanks to unSpawn's hint, I could recover all the missing partitions with it.

Now I only have to find a way to install grub in the mbr. It will not be a problem, as I did it several times. I used to do it by mounting the necessary hdd partitions, chrooting to them, then running yast. (This time I got a "kernel too old" error when trying to chroot to the mounted hdd partitions, but I will solve that by burning a boot CD with a newer kernel somewhere.)

By the way: all this mess started with a disappearing grub boot menu, and grub always starting xp instead of letting me choose the system to be booted.

Why does this happen, and how to correct it? It happens once in a year, rarely enough to allow me to forget how I solved the same problem the last time...

Last edited by J_Szucs; 07-04-2010 at 07:16 PM.
 
Old 07-04-2010, 07:29 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
If I understand things correctly, the MBR (AKA the boot sector) includes the partition table. Here is another reference:
http://www.pcguide.com/ref/hdd/file/structMBR-c.html

regardless, you can install GRUB using any Linux "live CD". Once running from Live CD, do "fdisl -l" to confirm how the disks and partitions are being seen---then start the grub shell (enter "grub").

From the grub shell, do this Assumes that the desired /boot/grub/menu.lst is on sda2 (partition #2 on disk #1), and that the boot code is going on sda (disk #1):
root (hd0,1)
setup (hd0)

Quote:
Why does this happen, and how to correct it? It happens once in a year, rarely enough to allow me to forget how I solved the same problem the last time...
The most common thing that happens is that Windows is installed---there is no choice, the MBR is taken over by the Windows boot code.
 
Old 07-05-2010, 01:39 AM   #8
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
Well, I think I will setup grub in the mbr by grub's own commands this time, for the sake of simplicity.

Anyway, my first thought was also that the grub boot menu disappeared because of xp messing up the boot code in the mbr. That is why I tried to recover the original mbr from a backup (but using the wrong backup unfortunately).

But thinking it over, I remember grub's boot message to flash for a half second each time it started xp. So, it may happen that grub was in place, but "not working correctly" in the mbr.

My second thought is that the file system on which grub's stageX files are located may be damaged, and that is why grub no longer loads its boot menu sometimes. But this is also an unlikely reason, as I mounted all file systems using the System Rescue CD correctly (in fact, the reiserfs driver rolling back some transactions), but the grub boot menu would not appear after that, either.

So, I am still clueless, why the grub boot menu is permanently "disabled" occasionally...

Last edited by J_Szucs; 07-05-2010 at 12:31 PM.
 
Old 07-05-2010, 12:26 PM   #9
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
I reinstalled grub in the mbr, and it still only started xp.

The new System Rescue CD has now a "Boot installed linux system" item in the boot menu, by which I could boot into the existing linux system without manually chrooting to it.

That solved the problem: from that time on, the grub boot menu works.

I think it is not xp messing up with the mbr or grub, but it may rather be an old linux-related bug.
 
  


Reply



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
File recovery after partition table damage - XFS file system gracecourt Linux - General 4 09-28-2017 05:29 PM
"No partition table or unknown signature on partition table" 10.1 install madcow007 Slackware 4 02-09-2009 11:04 AM
fs damage. e2fsck will not run to fix linux partition aya_rei Linux - Software 4 02-23-2005 08:55 AM
Slack 10: S-ATA = "No partition table or unknown signature on partition table"? dissolved soul Slackware - Installation 11 08-05-2004 02:12 PM
Partition damage? godsdog Linux - Newbie 5 07-14-2004 12:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:37 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration