LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 09-02-2003, 04:46 AM   #1
BigBadPenguin
Member
 
Registered: Jun 2003
Location: Warwick (.ac.uk)
Distribution: Arch, Slackware 9.0, (knoppix standing by)
Posts: 256

Rep: Reputation: 30
Corrupt Partition Table


Morning all,
I know this isn't quite a hardware question, more low-level software, but this forum seemed the right level of techiness to ask . Anyway, I've managed to bugger my partition table. This was either: 1 when i deleted my /boot (don't worry, i recovered it) 2. When i hard rebooted mid-load (I wanted to check my /boot fix had worked, and linux was very early on in the boot process) or 3. when i started to install gentoo.
I think 1 is most likely, but to be honest i don't really care why it happened. This is the result:

Out of the following:
Code:
/etc/fstab (still accessible)
/dev/hda7        swap             swap        defaults              0   0
/dev/hda1        /                ext2        defaults              1   1
/dev/hda9        /usr             ext2        defaults              1   2
/dev/hda10       /boot            ext2        defaults              1   2
/dev/hda5        /home            ext2        defaults              1   2
/dev/hda6        /var             ext2        defaults              1   2
/dev/hda8        /stuff           ext2        defaults              1   0
with /dev/hda3 being spare to load other distros
1 3 and 5 are accessible, so i can boot into slack but do little else (using knoppix right now).
I downloaded www.planetmirror.com/pub/gpart/]gpart[/URL]
and did the scan. This confirmed what i feared, a corrupt partition table but did\t correctly find my partitions. However, it struck me i have a printout of fdisk -l from YESTERDAY (prelimary to installing gentoo) ao I have the geometry and all.
I wondered if i can use fdisk and manually repair the partition table. Would it just be a case of adding the partitions in exactly the same place and printing the table? Might i salvage some stuff? I wanted to check here first (and i did search, but i think theses matters are handled best on a case to case basis) to see if this would be a good idea, cos i'm fed up of finding my partition ideas are bad the hard way.
Cheers for any help
-bbp
 
Old 09-02-2003, 10:55 AM   #2
fancypiper
Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
I managed to recover once after a Windows install re-wrote the partition table for me. I found a piece of paper with some numbers on it and it just happened to be my last partitioning scheme for that drive.

I booted a knoppix live cd, ran fdisk and partitioned again, intstalled grub and wow! It was all back, just like before.

What a relief it was as I had been doing everything in Linux for about a year and a half, so I had tons of stuff I could have lost.

Now I do backups....

Give it a shot. I don't know if /boot will be screwed up though.
 
Old 09-02-2003, 11:17 AM   #3
BigBadPenguin
Member
 
Registered: Jun 2003
Location: Warwick (.ac.uk)
Distribution: Arch, Slackware 9.0, (knoppix standing by)
Posts: 256

Original Poster
Rep: Reputation: 30
Thanks a lot, I've actually just rebooted it from trying it. Unfortuanately the former partition table was generated by parted, and the new fdisk table doesn't quite match, the start and end cylinders are the same but for two of the partitions the blocks don't match:
Code:
OLD PARTITION TABLE

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       624   5012248+  83  Linux                                (/)
/dev/hda2          1841      9733  63400522+   f  Win95 Ext'd (LBA)  
/dev/hda3           625      1840   9767520   83  Linux                              (empty)
/dev/hda5          9037      9551   4136706   83  Linux                             (/home)
/dev/hda6          8909      8991    666697+  83  Linux                             (/var)
/dev/hda7          9552      9733   1461883+  82  Linux swap                   (swap)
/dev/hda8          1841      5724  31198167   83  Linux                            (media)
/dev/hda9          5725      8907  25567416   83  Linux                            (/usr)
/dev/hda10         8908      8908      8001   83  Linux                               (/boot)
Code:
NEW PARTITION TABLE

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       624   5012248+  83  Linux                                (/)
/dev/hda2          1841      9733  63400522+   f  Win95 Ext'd (LBA)
/dev/hda3           625      1840   9767520   83  Linux                              (empty)
/dev/hda5          9037      9551   4136706   83  Linux                             (/home)
/dev/hda6          8909      8991    666697+  83  Linux                             (/var)
/dev/hda7          9552      9733   1461883+  82  Linux swap                   (swap)
/dev/hda8          1841      5724  31198198+  83  Linux                           (media)
/dev/hda9          5725      8907  25567416   83  Linux                            (/usr)
/dev/hda10         8908      8908      7969+  83  Linux                              (/boot)
See what I mean? 8 and 10 aren't right.
As a result All of my partions are working now (mounting in knoppix) apart from 2 (8 and 9, strangely enough, which SUCKS; boot is recognised perfectly). Since I have the copy of the old partition table, if i could access the table directly I'd be able to fix, and judging by the results so far, recover.
Any idea where i can find a program? Searching so far has told me i need a ptedit.exe clone, and there's one on sourceforge but it's in the planning stage still.

Last edited by BigBadPenguin; 09-02-2003 at 11:19 AM.
 
Old 09-02-2003, 12:02 PM   #4
BigBadPenguin
Member
 
Registered: Jun 2003
Location: Warwick (.ac.uk)
Distribution: Arch, Slackware 9.0, (knoppix standing by)
Posts: 256

Original Poster
Rep: Reputation: 30
Talking sorted

Well, worked better this time . I couldn't install parted on knoppix ramdisk cos of dependencies, so i looked what other stuff there was. ran sfdisk, cfdisk and nparted and all gave me errors of some kind. Then i ran fdisk again and the numbers were suddenly right! So, i'm back in slack now, with every partition running on all cylinders. Thanks a lot for your help.
 
  


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
Reduce LV -> Partition table corrupt dubya Fedora 5 06-17-2005 11:35 PM
superblock or partition table corrupt? Kristian2 Linux - Newbie 1 05-11-2004 10:34 AM
corrupt partition table Verso Linux - Hardware 5 12-16-2003 11:23 AM
partition table invalid or corrupt colindoig Linux - Software 3 10-01-2003 10:14 PM
Corrupt partition table mback Linux - Software 3 04-27-2002 12:30 PM


All times are GMT -5. The time now is 05:34 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration