Data Recovery After DD comand, possible? I really hope so...
Linux - GeneralThis 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
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
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?
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
Is there no Industrial Strength or Forensic solution that can do it? Or totally impossible to recover that initial 60gb?
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.
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.
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...
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.