LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-27-2003, 01:49 PM   #1
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Rep: Reputation: 15
need help recovering partition table


long story short, i issued the following command:

dd if=/dev/zero of=/dev/sda bs=512 count=1

how do i recover my partitions and data?
 
Old 11-27-2003, 01:54 PM   #2
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Rep: Reputation: 47
you don't I'm afraid and afaik
 
Old 11-27-2003, 08:22 PM   #3
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Original Poster
Rep: Reputation: 15
well, i had no luck with gpart, testdisk, and fixdisktable. however, rescuept gave me some decent info. partitionmagic 8 gave me nothing. i can't believe the little 10 sec command took out the entire disk.


you see, i had a dual boot with winnt4 and redhat 7.3. i needed usb support so i thought this would be a great time to upgrade to win2k - takes too long in linux to get usb up and running. i did the upgrade but i had problems with grub. so i said why not wipe out grub. i tried the dos fdisk /mbr method but since my partition was 6gig ntfs, it would not work. so i looked for a linux way to wipe mbr. well the newsgroups gave me a great way! all i wanted was a way to use my usb2 sandisk drive so i could read some docs off it and get ahead in my job. i should have not gotten out of bed today.

Last edited by hank43; 11-27-2003 at 08:29 PM.
 
Old 11-27-2003, 08:26 PM   #4
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Rep: Reputation: 47
That's the danger of trying stuff as root.
I feel your pain though, a long time ago I had something similar.
I sure hope nothing important was on that disk, always take backups.
 
Old 11-27-2003, 09:12 PM   #5
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
If you had run lilo before doing that then in /boot there is a backup of the bootsector. I'm not sure what the number would be for sda but for hda it would be /boot.0300
 
Old 11-27-2003, 09:15 PM   #6
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
The partition table is is between bytes 447 - 512 the first part would be lilo. If you do a dd if=/boot/boot.0300 of=/dev/hda then you will uninstall lilo. But thats easy to fix, just run lilo again.
 
Old 11-27-2003, 09:17 PM   #7
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
You should be able to boot the Redhat into rescue mode and fix this.
 
Old 11-27-2003, 09:59 PM   #8
iceman47
Senior Member
 
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123

Rep: Reputation: 47
jesus, you're right, it's only 512 bytes, totally looked over that.
Great
 
Old 11-28-2003, 05:29 AM   #9
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Original Poster
Rep: Reputation: 15
/dev/sda looks empty to the os. i ran gpart, rescuept , etc by moving the disk to another linux box since i would boot off the scsi disk. so would the scsi version of

dd if=/boot/boot.0300 of=/dev/hda

still work?
 
Old 11-28-2003, 07:23 AM   #10
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Original Poster
Rep: Reputation: 15
here is what i got from rescuept:

[root@localhost linux]# /sbin/rescuept /dev/sda
# partition table of /dev/sda
# total size 35566478 sectors
unit: sectors
# 0 MB candidate ext pt (type 5): sectors 1541061- 1541061
# 4001 MB found in ept (type 7): sectors 1541124- 9734210
# 4001 MB extended part ok (type 5): sectors 1541061- 9734210
# 10 MB small fat partition (type 1): sectors 10079654- 10100392
# 0 MB candidate ext pt (type 5): sectors 13109040- 13109040
# retracted
# 55 MB ext2 partition (type 83): sectors 13109040- 13221493
# 2000 MB fat partition (type 6): sectors 13221495- 17318069
# 0 MB candidate ext pt (type 5): sectors 17318070- 17318070
# 1004 MB found in ept (type 83): sectors 17318133- 19374389
# 3004 MB found in ept (type 83): sectors 19374453- 25527284
# 2000 MB found in ept (type 83): sectors 25527348- 29623859
# 133 MB found in ept (type 82): sectors 29623923- 29896964
# 1757 MB found in ept (type 6): sectors 29897028- 33495524
# 1004 MB found in ept (type 6): sectors 33495588- 35551844
# 8903 MB extended part ok (type 5): sectors 17318070- 35551844
/dev/sda0 : start= 1541061, size= 8193150, Id= 5
/dev/sda0 : start= 1541124, size= 8193087, Id= 7
/dev/sda0 : start= 10079654, size= 20739, Id= 1
/dev/sda0 : start= 13109040, size= 112454, Id=83
/dev/sda0 : start= 13221495, size= 4096575, Id= 6
/dev/sda0 : start= 17318070, size=18233775, Id= 5
/dev/sda0 : start= 17318133, size= 2056257, Id=83
/dev/sda0 : start= 19374453, size= 6152832, Id=83
/dev/sda0 : start= 25527348, size= 4096512, Id=83
/dev/sda0 : start= 29623923, size= 273042, Id=82
/dev/sda0 : start= 29897028, size= 3598497, Id= 6
/dev/sda0 : start= 33495588, size= 2056257, Id= 6



from what i can remember i had and the above output:

primary1: 6.4gb ntfs
primary2: 55mb ext3, /boot
primary3: ? not sure if i had a 3rd primary but the 2000 MB fat makes sense

extended:
1004 MB ext3, /
3004 MB ext3, /home
2000 MB ext3, /usr
133 MB swap
1757 MB fat
1004 MB fat

it is a 18.4 gb quantum atlas 10k iii scsi drive. I would really appreciate any tips or advice you can give me to restore the data.
 
Old 11-28-2003, 01:00 PM   #11
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Why don't you go ahead and try fdisk? The partition table is trashed the way it is, and if you mess up you know how to erase it right?

If you are having trouble converting the sectors into cylinders then just toggle fdisk to sectors using the u command.
 
Old 11-29-2003, 01:55 PM   #12
hank43
Member
 
Registered: Nov 2003
Distribution: centos 4.4
Posts: 94

Original Poster
Rep: Reputation: 15
got it!

ok, i got my data back! used fdisk -u and the output from rescuept to recreate the partition table. data has been backed up to another disk.
 
Old 11-29-2003, 11:04 PM   #13
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Great.

Even though lilo makes a backup of the bootsector I usually make another 1 or 5 backups and keep them on other partitions, or windows partitions or even floppy.

In your case you rebooted which made the drive unreadable. But if you had access to a backup bootsector you could have saved yourself alot of work.

For future reference, you could have undone the oops like this:
lilo -u # That would put the original bootsector (with the partition table) back on the drive.
lilo # This would reinstall lilo since the first command removed 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
"No partition table or unknown signature on partition table" 10.1 install madcow007 Slackware 4 02-09-2009 11:04 AM
Recovering a Partition? morrolan Linux - Newbie 5 09-05-2005 10:53 AM
Recovering partition belorion Linux - Software 5 08-09-2004 03:16 PM
Slack 10: S-ATA = "No partition table or unknown signature on partition table"? dissolved soul Slackware - Installation 11 08-05-2004 02:12 PM
[B]PARTITION TABLE TOASTED - NEED help recovering data!!![/B] Daddio Linux - General 0 06-30-2004 08:05 PM

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

All times are GMT -5. The time now is 05:33 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
Open Source Consulting | Domain Registration