Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I need help!!! It's a long message, but i hope somebody does read it.. I've tried to give it some pointwise structure..
-->I had fedora core 2 + windows 98 dual boot on my pc,
-->but screwed up my HDD's partition table over a week ago while installing Mandrake 10.1..
-->partition table of /dev/hda was crooked even before i installed mandrake,used to show some 'overlapping' error,but was working.
-->Two partitions stopped showing on windows and linux became unbootable after the crash.
-->So i formatted the linux partition, and mindlessly did 'fdisk /mbr', and while trying to see data in my previous extended partition, the dos fdisk did an "integrity check" on it, and it stopped working.
-->I have tried testdisk, gpart and ranish's partition table editor, but this has helped me recover only 1 out of the 2 partitions that were lost.
-->The partitions as far as i remember, before the disaster were :
1 windows ( around 10 gb )
one exteneded partition consisting of 2 logical parts : linux ( 8 gb ) & one other partition ( maybe a swap partition )
& 2 more partitions of 8 gb each for songs.
Disk utilities used to show errors like corrupt partition table, overlapping partitions etc. but everything worked k even after errors.
-->One thing i did before installing mandrake was to save the output of fdisk -l command on my main hard disk.. it was as follows :
-------------------------
Disk /dev/hdd: 20.0 GB, 20020396032 bytes
16 heads, 63 sectors/track, 38792 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdd1 * 1 19380 9767488+ c W95 FAT32 (LBA)
/dev/hdd2 19381 38792 9783648 f W95 Ext'd (LBA)
/dev/hdd5 19381 38792 9783616+ b W95 FAT32
Disk /dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 20321 10241752+ c W95 FAT32 (LBA)
/dev/hda2 59814 60021 104422+ 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/hda3 20321 59814 19904535 f W95 Ext'd (LBA)
Partition 3 does not end on cylinder boundary.
/dev/hda4 60021 77536 8827717+ 8e Linux LVM
Partition 4 does not end on cylinder boundary.
/dev/hda5 20321 38776 9301635 b W95 FAT32
/dev/hda6 38777 59814 10603152 b W95 FAT32
Partition table entries are not in disk order
-------------------------
-->also, i don't remember how, but i have o/p of gpart when the harddisk was working ( probably )...
dev(/dev/hda) master boot record (w/o partition table):
0000: fa eb 21 01 b4 01 4c 49 4c 4f 16 05 51 86 35 42
. . ! . . . L I L O . . Q . 5 B
0010: 00 00 00 00 57 b9 e5 01 57 75 09 00 01 00 80 60
. . . . W . . . W u . . . . . `
0020: 4a 30 98 03 b8 c0 07 8e d0 bc 00 08 fb 52 53 06
J 0 . . . . . . . . . . . R S .
0030: 56 fc 8e d8 31 ed 60 b8 00 12 b3 36 cd 10 61 b0
V . . . 1 . ` . . . . 6 . . a .
0040: 0d e8 66 01 b0 0a e8 61 01 b0 4c e8 5c 01 60 1e
. . f . . . . a . . L . \ . ` .
0050: 07 80 fa fe 75 02 88 f2 bb 00 02 8a 76 1e 89 d0
. . . . u . . . . . . . v . . .
0060: 80 e4 80 30 e0 78 0a 3c 10 73 06 f6 46 1c 40 75
. . . 0 . x . < . s . . F . @ u
0070: 2c 88 f2 66 8b 7e 18 66 09 ff 74 21 52 b4 08 b2
, . . f . ~ . f . . t ! R . . .
0080: 80 cd 13 72 55 92 98 91 ba 7f 00 42 66 31 c0 40
. . . r U . . . . . . B f 1 . @
0090: e8 71 00 66 3b bf b8 01 74 03 e2 ef 5a 53 8a 76
. q . f ; . . . t . . . Z S . v
00A0: 1f be 20 00 e8 4b 00 b4 99 66 81 7f fc 4c 49 4c
. . . . K . . . f . . . L I L
00B0: 4f 75 27 5e 68 80 08 07 31 db e8 35 00 75 fb be
O u ' ^ h . . . 1 . . 5 . u . .
00C0: 06 00 89 f7 b9 0a 00 f3 a6 75 0d b0 02 ae 75 08
. . . . . . . . . u . . . . u .
00D0: 06 55 b0 49 e8 d3 00 cb b4 9a b0 20 e8 cb 00 e8
. U . I . . . . . . . . . . .
00E0: b8 00 fe 4e 00 74 08 bc e8 07 61 60 e9 60 ff f4
. . . N . t . . . . a ` . ` . .
00F0: eb fd 66 ad 66 09 c0 74 0a 66 03 46 10 e8 04 00
. . f . f . . t . f . F . . . .
0100: 80 c7 02 c3 60 55 55 66 50 06 53 6a 01 6a 10 89
. . . . ` U U f P . S j . j . .
0110: e6 53 f6 c6 60 74 58 f6 c6 20 74 14 bb aa 55 b4
. S . . ` t X . . t . . . U .
0120: 41 cd 13 72 0b 81 fb 55 aa 75 05 f6 c1 01 75 4a
A . . r . . . U . u . . . . u J
0130: 52 06 b4 08 cd 13 07 72 59 51 c0 e9 06 86 e9 89
R . . . . . . r Y Q . . . . . .
0140: cf 59 c1 ea 08 92 40 83 e1 3f f7 e1 93 8b 44 08
. Y . . . . @ . . ? . . . . D .
0150: 8b 54 0a 39 da 73 39 f7 f3 39 f8 77 33 c0 e4 06
. T . 9 . s 9 . . 9 . w 3 . . .
0160: 86 e0 92 f6 f1 08 e2 89 d1 41 5a 88 c6 eb 06 66
. . . . . . . . . A Z . . . . f
0170: 50 59 58 88 e6 b8 01 02 eb 02 b4 42 5b bd 05 00
P Y X . . . . . . . . B [ . . .
0180: 60 cd 13 73 10 4d 74 0a 31 c0 cd 13 61 4d eb f0
` . . s . M t . 1 . . . a M . .
0190: b4 40 e9 45 ff 8d 64 10 61 c3 c1 c0 04 e8 03 00
. @ . E . . d . a . . . . . . .
01A0: c1 c0 04 24 0f 27 04 f0 14 40 60 bb 07 00 b4 0e
. . . $ . ' . . . @ ` . . . . .
-------------------------
( some logical + extended partition overlapping probably )
-------------------------
-->Now, output of "fdisk -l" is as follows :
-------------------------
Disk /dev/hdd: 20.0 GB, 20020396032 bytes
16 heads, 63 sectors/track, 38792 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdd1 * 1 19380 9767488+ c W95 FAT32 (LBA)
/dev/hdd2 19381 38792 9783648 f W95 Ext'd (LBA)
/dev/hdd5 19381 38792 9783616+ b W95 FAT32
Disk /dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 20321 10241752+ c W95 FAT32 (LBA)
/dev/hda2 38777 59814 10602868+ c W95 FAT32 (LBA)
/dev/hda3 20322 38776 9301320 f W95 Ext'd (LBA)
/dev/hda4 59860 77069 8673840 83 Linux
/dev/hda5 20322 38776 9301288+ b W95 FAT32
Partition table entries are not in disk order
-------------------------
-->I know that the data is still there, and it's accessible too using GetDataBack, but i want to somehow get that partition showing again and working properly..
-->-->My Question:
----------------------
can i edit my partition manually and feed the previous ( even overlapping ) values ?
And don't think that i've been idle in the last few weeks, i have read many threads about hdd partition recovery on LQ and googled a lot ( found mostly commercial s/w there ).. But in vain.
You have all the information you need to recover your partition table manually, but you have to know what you are doing.
Also, you say you had warnings about overlapping partitions but "everything was working". Overlapping partitions will inevitably lead to file system corruption and data loss, when you least expect it. You do need to fix this, but not until after you have recovered data. The indicated partitions for your drive hda are a mess; you need to straighten that out and know what it is you want to accomplish before you do anything.
You will need the linux disk editor (lde) - try to find it on your system and if you can't then google for it.
Alternatively you will need to use the dd command and a hex editor. Using lde would be simpler because you can alter the MBR in place but if you have to you can extract the MBR using dd, then edit it in a hex editor, then put it back.
Go here for detailed information on the structure of partition tables and the exact location of every byte of information contained in the partition table.
Yes, the dd command you list will back up your MBR. Beyond that, try parted as I specified in an edit of my previous post. IIRC, I suggested this to you when you first posted about your problem.
but won't parted format the partitions created by me.. or if i give the wrong parameters, overwrite some of my data .. ? ( i can risk losing a few files.. most of data on the lost partition was songs in mp3 format )...
i tried its 'mkpart' & 'rescue' commands, but that didn't help in recovery.. prob i faced was that it takes input in "mega bytes" and i've the backup info in blocks ( i suppose )..
am apprehensive about using lde as it looks quite difficult to use.
isn't there any disk partition table editor in which i could directly feed the backup values that i have with me ( in blocks/sectors whatever .. )
Cant help a whole lot. I imagine you are doing a floppy of net boot
Your probably going to have to do a nfs mount or boot off other drive
then
e.g.
sfdisk -d /dev/hda > partitiontable.out
That will give you the table and later you will be able to cat partitiontable.out | sfdisk /dev/hda
But to do the back up use dump and restore you can put these on the NFS mount
Think this is the syntax
dump 0 -f /mnt/somenfsmount/opt.dump /dev/hda3
Then you can use restore later
A bit of advise no matter what the tool tells you make sure to run fsck on a dry run after partitioning
After many weeks of fiddling with linux tools.. i finally got hold of one for windows. called "partition table doctor" and it worked like magic.. !
the screwed up partition was fixed, and it was too easy to do ? why aren't there such tools for linux too ? ( i've used testdisk many times.. but believe me PTD is much more user friendly. )
but a few of my mp3's are corrupted due to the whole ordeal.. :-( really doesn't matter that much though
then i converted a partition from logical to primary using partition magic, and installed mandrake.. TOO EASY installation.. and what cooool interface ... and the amrok mp3 player is tooo good..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.