LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 02-27-2013, 07:31 AM   #1
im-learning-linux
LQ Newbie
 
Registered: Feb 2013
Posts: 3

Rep: Reputation: Disabled
Data Recovery After DD comand, possible? I really hope so...


Hello to all, hoping someone on here can help? TIA

I was upgrading my laptop to a larger HDD, 60gb - 320gb and thought that by using a Linux Live CD I could use the DD command to copy the 60gb to my external Samsung HDD, then install the 320gb HDD in my laptop, connect my external Samsung HDD and copy with DD to the new 320gb HDD.

The copying of the 60gb HDD has worked... However I messed up :-( as now I cannot find or see anything that I previously had on the external Samsung HDD.

So now I really need help and advice on how I may be able to recover what was previously on my external Samsung HDD before I DD'd etc.

I hope I have explianed my predicament sufficiently, but if anyone wants or needs further information to help me out of this mess then I'm happy to provide any further info required.

Please tell me everything will be OK :-)

Many thanks,

John
 
Old 02-27-2013, 07:41 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
Welcome to LinuxQuestions.

Without knowing the exact dd command(s) used it is impossible to determine if your data is recoverable.
 
Old 02-27-2013, 07:53 AM   #3
im-learning-linux
LQ Newbie
 
Registered: Feb 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi MichaelK,

Thanks for trying to assist me :-)

I identified the correct disks using fdisk -l

then used dd if=/dev/hda of=/dev/sda bs=32256, (this is the command used, but the hda sda may be wrong way round 60gb -IDE, Samsung - SATA) but I did identify the correct disks with the fdisk -l command. But now cannot see/find what was on my external Samsung HDD beforehand.

Thanks again for trying to help :-)

John
 
Old 02-27-2013, 08:10 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
Quote:
dd if=/dev/hda of=/dev/sda bs=32256
dd performs a byte for byte copy so you basically lost the first 60GB of data on the hard drive including the partition table and it can not be recovered. if you had more the 60GB of data you might be able to recover it using the testdisk or photorec utilities.

dd was really not the best choice for what you wanted to accomplish but the correct syntax would of been something like
Quote:
dd if=/dev/hda of=/external_drive_mount_point/backup.file
http://www.linuxquestions.org/questi...ommand-362506/

Last edited by michaelk; 02-27-2013 at 08:18 AM.
 
Old 02-27-2013, 08:28 AM   #5
im-learning-linux
LQ Newbie
 
Registered: Feb 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks MichaelK,

Really gutted :-( that I've lost that 60gb, damn. Can you explain the correct way of using testdisk and photorec utilities please. :-)

Also I see on other posts/forums etc people mention ddrescue and foremost, but assume these will not work for my specific situation??? Is there no Industrial Strength or Forensic solution that can do it? Or totally impossible to recover that initial 60gb?

Thanks again,

John
 
Old 02-27-2013, 08:50 AM   #6
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,991

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
This is why dd has the nickname "disk destroyer". It should only be used if you know EXACTLY what you're doing, otherwise there's a very real possibility (nay, probability) that you'll mess up and wipe a disk. The better choice, in my opinion, would be to use something like rsync to back up all of your files onto the external drive, install the new drive, install the OS from scratch, and then copy the necessary files back over.

Quote:
Originally Posted by im-learning-linux View Post
Is there no Industrial Strength or Forensic solution that can do it? Or totally impossible to recover that initial 60gb?
Not that I know of.

To use photorec, just run it on the drive in question and follow the prompts.
http://www.cgsecurity.org/wiki/PhotoRec_Step_By_Step
 
Old 02-27-2013, 09:24 AM   #7
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 808
Blog Entries: 2

Rep: Reputation: 203Reputation: 203Reputation: 203
I'm a little vague what happened here. It sounds like
- dd from existing 60GB drive to external drive (using device file not a filename in a filesystem)
- change to new internal drive
- aim to copy data back from intermediate (external) storage
- that doesn't produce a working system

If that's all that happened isn't the original data unharmed on the 60GB drive so the whole process could be redone properly?

OK I get it - the external intermediate drive is the one that's needs recovery.

Last edited by linosaurusroot; 02-27-2013 at 09:26 AM.
 
Old 02-27-2013, 09:27 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
Your correct they will not work for your situation. Foremost works because in a nutshell the pointer to the file was deleted but not the actual file itself as long as it was not over written. ddrescue is a smarter version of dd since it can recover from errors whereby the later can not.

For all practicable purposes the data is lost.
 
Old 02-27-2013, 07:47 PM   #9
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 158

Rep: Reputation: 23
Looks like you have overwritten the first 60GB of your external Samsung, sector-by-sector. Whatever was stored there got overwritten entirely. Only the remaining part of that harddisk is still untouched, but now as you have also overwritten the very first sectors which contain the partition table, the remaining partitions won't be identified anymore, so a rescue/analyze session ala testdisk will be required to recover files on the remaining N-60GB of the disk.

Also, after restoring the 60GB dump with dd back to your new 320GB harddisk, that one will now also show the same partitions with an overall size of 60GB, with 260GB unused diskspace that follows, so you'll probably want to re-partition the new harddisk anyhow. In the first place, you should have created a 60+GB partition on your external hd and then copy all files from the 60er to the external one, piece-by-piece (using either mc, rsync or maybe with cp if you read the man first) or using tar or squashfs. Then insert the 320er hd, partition it as you desire, then restore the files & folders from the external back to the partitions on the new 320er.

Sorry to hear you lost data. As others already mentioned, dd will relentlessly do as told and must therefor be treated with extreme caution, as even the slightest mistake (wrong destination device given...) can quickly create major headaches...
 
Old 02-28-2013, 11:43 PM   #10
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
Quote:
As others already mentioned, dd will relentlessly do as told and must therefore be treated with extreme caution, as even the slightest mistake (wrong destination device given...) can quickly create major headaches...
Indeed.. I'd also like to point out that this is generally true of the (cli) cmds in *nix. It was written by programmers for programmers; the underlying assumption is that you know what you're doing, so there are no 'Are You Sure' and such like responses.

My condolences for your data loss.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: HP and Oracle Hope to Make Sense of Big Data LXer Syndicated Linux News 0 10-20-2011 09:20 PM
[SOLVED] Combining anti-virus + data recovery + image recovery? littlebigman Linux - Software 8 08-12-2010 02:39 AM
dd comand wiped out data (possible to recover?) davidleroux1 Linux - General 13 02-12-2007 11:58 PM
LXer: Linux Data Recovery on Windows - Is possible through Disk Doctors Linux Recovery Software LXer Syndicated Linux News 0 10-22-2006 12:21 PM
starting to panic, hope i can get my data back santaliqueur Linux - Software 12 10-04-2005 10:46 PM


All times are GMT -5. The time now is 11:57 AM.

Main Menu
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