LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-31-2004, 01:27 AM   #1
notb
LQ Newbie
 
Registered: Oct 2004
Posts: 2

Rep: Reputation: 0
Partition corruption fix validation


Folks,

The Linux partition on my dual boot PC did not survive a recent physical move. Since there was no vital data on that partition and I was running an old RH distro, I decided to upgrade to Fedora Core 2. Now WinXP won't come up and I believe it's due to a corrupted partition table. I have an idea how to fix it but I would like some feedback before attempting what I think is a risky operation.

The computer has a single 80G Seagate HD and partitioned in order with: 10G ext3, 500M Linux swap, 10G FAT 32, around 50G FAT32 in an extended (non primary) partition. I think the partition table is out of whack because of the output I get from several Linux utilities.

[root@localhost]# fdisk -l
Unable to seek on /dev/hda

[root@localhost]# sfdisk -l /dev/hda

Disk /dev/hda: 0 cylinders, 12 heads, 0 sectors/track
llseek: Invalid argument

sfdisk: seek error on /dev/hda - cannot seek to 42009975
Warning: The partition table looks like it was made
for C/H/S=*/16/63 (instead of 0/12/0).
For this listing I'll assume that geometry.
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 20320- 20321- 10241406 83 Linux
/dev/hda2 20320+ 21356- 1036- 522112+ 82 Linux swap
/dev/hda3 * 21356+ 41676- 20321- 10241437+ c W95 FAT32 (LBA)
/dev/hda4 41676+ 154657- 112981- 56942392+ f W95 Ext'd (LBA)


I changed my BIOS HD seting from auto to LBA (other choices are CHS and both) and got 9729 cylinders, 255 heads, 63 sectors. Using a Knoppix LIve CD I passed that info at the boot prompt: vmlinuz hda=9729,255,63.

Since, things are looking much better:

[root@localhost root]# /sbin/sfdisk -l /dev/hda

Disk /dev/hda: 9729 cylinders, 255 heads, 63 sectors/track
Warning: The partition table looks like it was made
for C/H/S=*/16/63 (instead of 9729/255/63).
For this listing I'll assume that geometry.
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 20320- 20321- 10241406 83 Linux
/dev/hda2 20320+ 21356- 1036- 522112+ 82 Linux swap
/dev/hda3 * 21356+ 41676- 20321- 10241437+ c W95 FAT32 (LBA)
/dev/hda4 41676+ 154657- 112981- 56942392+ f W95 Ext'd (LBA)
/dev/hda5 41676+ 154657- 112981- 56942361 b W95 FAT32


I am even able to mount the windows partition and view the content! Now, how do I fix the partition table with this information? Should I follow the directions outlined on the RH site under archives/fedora-devel-list/2004-May/msg00908.html
Basically using sfdisk to re-write the proper info? Something like:
sfdisk -d /dev/hda | sfdisk --no-reread -H255 -C9729 /dev/hda

Anyone knows a way to first test this with Windows? Anyway to pass the HD settings at boot time? Any other gotchas I shoudl worry about?

Thanks in advance.



Note 1: Grub seems to find WinXP property. But Win outputs a series of:
multi(0)disk(0)rdisk(0)partition(1)..., eventually craps out and brings me back to the POST screen.

Note 2: The gpart tool always died on a floating point exception before I passed the proper hdd parameter at the boot prompt. It now reports:
[root@localhost src]# ./gpart /dev/hda

Begin scan...
Possible partition(Linux ext2), size(10001mb), offset(0mb)
Possible partition(Linux swap), size(509mb), offset(10001mb)
Possible partition(DOS FAT), size(10001mb), offset(10511mb)
Possible extended partition at offset(20512mb)
Possible partition(DOS FAT), size(55607mb), offset(20512mb)
End scan.

Checking partitions...
Partition(Linux ext2 filesystem): primary
Partition(Linux swap or Solaris/x86): primary
Partition(DOS or Windows 95 with 32 bit FAT, LBA): primary
Partition(DOS or Windows 95 with 32 bit FAT, LBA): primary
Ok.

Guessed primary partition table:
Primary partition(1)
type: 131(0x83)(Linux ext2 filesystem)
size: 10001mb #s(20482808) s(63-20482870)
chs: (0/1/1)-(1023/254/63)d (0/1/1)-(1274/254/59)r

Primary partition(2)
type: 130(0x82)(Linux swap or Solaris/x86)
size: 509mb #s(1044224) s(20482875-21527098)
chs: (1023/254/63)-(1023/254/63)d (1275/0/1)-(1339/254/62)r

Primary partition(3)
type: 012(0x0C)(DOS or Windows 95 with 32 bit FAT, LBA)
size: 10001mb #s(20482875) s(21527100-42009974)
chs: (1023/254/63)-(1023/254/63)d (1340/0/1)-(2614/254/63)r

Primary partition(4)
type: 012(0x0C)(DOS or Windows 95 with 32 bit FAT, LBA)
size: 55607mb #s(113884722) s(42010038-155894759)
chs: (1023/254/63)-(1023/254/63)d (2615/1/1)-(9703/254/63)r
 
Old 10-31-2004, 01:47 AM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
I don't have FC2 either but this has some links for both suse and FC that may help.
http://www.linuxquestions.org/questi...hlight=trouble

2) I appreciate you have tried to troubleshoot with the dodgy partition. think nothing of it ...you NEED to fix the partition table first

3) However, you do appear to have linux b4 windows as my link says you may need to hide linux so the grub enty for xp

title xp
hide (hd0,0)
rootnoverify (hd0,2)
chainloader +1

title linux
root (hd0,0)
kernel etc
initrd etc

BTW are you sure your XP is fat? I thought it was formatted as ntfs?
 
Old 11-08-2004, 09:54 AM   #3
notb
LQ Newbie
 
Registered: Oct 2004
Posts: 2

Original Poster
Rep: Reputation: 0
Here's a follow up in case anyone is searching the archive.

The solution I wanted feedback on actually worked:

1. Boot and pass proper HCS to boot loader.

2. sfdisk -d /dev/hda > MyPartition.txt

3. Edit MyPartition.txt and remove warning msgs

4. cat My Partition.txt | sfdisk --force --no-reread -H255 /dev/hda

I did not pass the number of cylinders and it worked. So there you have it.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Partition Nightmare - Is there any way to fix this? integrale Linux - General 7 09-02-2005 04:52 PM
all attempts to fix the problem failed... can someone help me fix partition space? foreverdita Linux - Enterprise 2 05-11-2005 09:02 AM
trying to fix a bad partition table poiuytrewq Linux - Hardware 1 11-22-2004 11:07 AM
how do i fix a bad partition table? rj1 Linux - General 2 02-18-2004 08:04 AM
How to fix a F*CKED-UP partition? Megamieuwsel Linux - General 9 09-27-2003 01:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:53 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