LinuxQuestions.org
Help answer threads with 0 replies.
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 01-28-2008, 09:21 AM   #1
Denadai
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Rep: Reputation: 0
Help! Might have overwritten hda


I was trying to read data off a friend's bad flash drive using dd_rescue (basically the same as dd). I couldn't get it to save the data to a file though, so I did the following (I'm quite embarassed):


dd_rescue /dev/sda /dev/hda

I thought it would just add an image of the flash drive to hda! Now, my comp will POST but grub will not load (I had a dual boot Debian/Windows, it just says "Strike F1 to retry boot).

What can I do to recover what I had? I'm hoping at least one of the partitions remains. I'll ask about using dd properly in another post. I presume it has something to do with a bootdisk, but I don't know what to put on the bootdisk to check what remains on the HD and get the MBR set up.
 
Old 01-28-2008, 09:39 AM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
How many partitions did you have on this machine?

The MBR and partition table is toast, as is the beginning of the first partition. Your other partitions should be alright, but it depends on how much dd wrote to the beginning of the drive and how large the first partition was in the first place. For instance, if you had a 64 MB /boot partition followed by your root partition, and you wrote 128 MB to the drive then you would have totally wiped out partition 1 and the beginning of partition 2.

Unless you have a backup of the partition table (MBR is easy enough to replicate) you are going to have a bit of a problem.

Last edited by MS3FGX; 01-28-2008 at 09:48 AM.
 
Old 01-28-2008, 09:43 AM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Boot with Knoppix, run testdisk, save what can be saved. Once partition table is restored you'll find everything is intact exept the hda1. OS in first partition has to be reinstalled, unless it was some Linux distro which can be rebuilt (like Gentoo).
 
Old 01-28-2008, 10:07 AM   #4
Denadai
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for the replies. I'll try Knoppix with testdisk and reply back if I have trouble.
 
Old 01-29-2008, 09:28 AM   #5
Denadai
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
I got Knoppix with testdisk, but still trouble. Here is what it says when I try to mount hda:

Quote:
Could not mount device.
The reported error was:
mount: I could not determine the filesystem type, and none was specified

Here is what shows up after I run fdisk -l after creating a new MBR with testdisk:

Quote:
Disk /dev/hda: 10.2 GB, 10254827520 bytes
16 heads, 63 sectors/track, 19870 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

This doesn't look like a partition table
Probably you selected the wrong device.

Device Boot Start End Blocks Id System
/dev/hda1 ? 1903842 603791 1492257792+ 9b Unknown
Partition 1 does not end on cylinder boundary.
/dev/hda2 ? 706379 977447 136618454 70 DiskSecure Multi-Boot
Partition 2 does not end on cylinder boundary.
/dev/hda3 ? 3839253 64813 245166142+ 72 Unknown
Partition 3 does not end on cylinder boundary.
/dev/hda4 ? 231194 3091252 1441469411+ e W95 FAT16 (LBA)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order

The ideal situation would be that Windows remains OK and I could rebuild Debian. Even if Windows is ruined I'd really like to restore Debian - had some mysql databases on it and a configuration I liked.
 
Old 01-29-2008, 09:42 AM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Do you recognize your disk layout? Testdisk can find old obsolete partitions, too. You do not mount hda which is entire HDD, you mount hda1, hda2, so on.
 
Old 01-29-2008, 01:50 PM   #7
snowman81
Member
 
Registered: Aug 2006
Location: Michigan
Distribution: Ubuntu
Posts: 282

Rep: Reputation: 30
You could boot with something like Helix and see what you can save. I know it's like knoppix, but it may work better.
 
Old 01-29-2008, 07:07 PM   #8
Denadai
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for the replies. I'm doing a little bit every day on this - I have a replacement computer at work so I can use that for now. Tomorrow or Thursday I am going to try to mount the hda1/hda2/hda3/hda4 partitions. I'm hoping at least hda2 and hda4 mount based on the post I made above - I don't know when it has file system unknown for hda1/hda3. I'll also try Helix if this doesn't work out. I'd really like to be able to rebuild the Debian partition, which I think should be hda1. I'll ask more after I try what's been suggested. Thanks again.
 
Old 01-29-2008, 07:23 PM   #9
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
I'm not convinced you restored correct partitions with testdisk. You should see your partitions with Windows and Linux filesystems. Only hda1 should show up "Unknown". In any case, if contents of this drive is important to you I suggest you take an image of it with dd before you change anything.
 
Old 01-30-2008, 04:05 PM   #10
Denadai
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Emerson View Post
I'm not convinced you restored correct partitions with testdisk. You should see your partitions with Windows and Linux filesystems. Only hda1 should show up "Unknown". In any case, if contents of this drive is important to you I suggest you take an image of it with dd before you change anything.
I believe hda1 should be Windows, hda2 is Debian, hda3 is swap, and hda4 is the flash drive data that I copied.

I edited /etc/fstab to look like the following:

Quote:
proc /proc proc rw,nosuid,nodev,noexec 0 0
/sys /sys sysfs rw,nosuid,nodev,noexec 0 0
/dev/shm /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0
/dev/pts /dev/pts devpts mode=0622 0 0
/dev/fd0 /media/fd0 auto user,noauto,exec,umask=000 0 0
/dev/cdrom /media/cdrom auto user,noauto,exec,ro 0 0
/dev/hdc /media/hdc auto users,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/hda1 /media/hda1 auto 0 0
/dev/hda2 /media/hda2 auto 0 0
/dev/hda3 /media/hda3 auto 0 0
/dev/hda4 /media/hda4 vfat 0 0
However, when I type mount /dev/hda2 /media/hda2, I get the message:

Quote:
mount: special device /dev/hda2 does not exist
Not sure where to go from here, maybe just a newb thing with not mounting properly?
 
Old 01-30-2008, 04:28 PM   #11
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
If you sent flashdrive data to hda then it cannot be on hda4. fdisk -l output does not look good. As I said before, try that teskdisk again, hda2, hda3 and hda4 should be intact.
 
  


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
slax proc # fdisk hda Unable to open hda farhan Linux - General 1 03-18-2007 11:23 AM
integrated hda audio modem bluetooth , (intel hda audio does not work) reggae linux Linux - Laptop and Netbook 1 07-05-2006 10:13 PM
integrated hda audio modem bluetooth , (intel hda audio does not work) reggae linux Linux - Laptop and Netbook 2 07-05-2006 03:38 PM
difference between hda and hda@ saurav_gohain Linux - General 1 07-08-2003 02:06 AM

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

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