LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 07-02-2013, 12:28 PM   #1
shaheenm
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Rep: Reputation: Disabled
Wrote an image to the wrong drive with dd


Hi there

I've made a monumental error. I was trying to write a raspberry-pi image from my usb hdd to my micro-SD card and mistakenly wrote the image back to my usb hdd.

The HD is a 250Gb and was formatted as FAT32. The rPi image is about 2Gb and basically overwrote my FAT32 partition tables. I know that the 2Gb that were written have been lost, but all my other data should still be on the drive. I just need to be able to get to it.

I used fdisk to try to set it back to a single FAT32 partition by deleting all the partitions from the rPi image and creating a FAT32 partition. fdisk accepts this but I cannot mount the drive.

I've made an image of the entire drive but it too will not mount.

Any help would be appreciated in trying to recover this. How do I create the partition tables whilst preserving the data? Or access the data so that I can get it back from the image?
 
Old 07-02-2013, 12:44 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,021

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
Hi there,

Quote:
Originally Posted by shaheenm View Post
I've made a monumental error. I was trying to write a raspberry-pi image from my usb hdd to my micro-SD card and mistakenly wrote the image back to my usb hdd.
that's really bad luck, especially as you don't seem to have a backup of your data.

Quote:
Originally Posted by shaheenm View Post
The HD is a 250Gb and was formatted as FAT32. The rPi image is about 2Gb and basically overwrote my FAT32 partition tables. I know that the 2Gb that were written have been lost, but all my other data should still be on the drive. I just need to be able to get to it.
If you wrote 2GB, you sure as hell wiped not only the partition table, but also the boot sector and the additional file system info sector of the FAT32 partition, as well as the FAT itself (which was between 32MB and 256MB in size, depending on the cluster size you selected when formatting the drive), and some of the files as such.

Quote:
Originally Posted by shaheenm View Post
I used fdisk to try to set it back to a single FAT32 partition by deleting all the partitions from the rPi image and creating a FAT32 partition. fdisk accepts this but I cannot mount the drive.
Of course you cannot. All information about the FAT32 file system is lost, there's nothing left to identify it as what it used to be.

Quote:
Originally Posted by shaheenm View Post
I've made an image of the entire drive but it too will not mount.
For the same reason.

Best advice I can give you is to try TestDisk, which is included in the repos of many Linux distros. Contrary to the name, its main purpose isn't testing a disk, but rather recovering data you thought was lost. I don't want to foster too much hope, but it's worth a try. Be prepared to face the worst, though.

[X] Doc CPU
 
1 members found this post helpful.
Old 07-02-2013, 12:59 PM   #3
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,094
Blog Entries: 2

Rep: Reputation: 111Reputation: 111
http://askubuntu.com/questions/14736...at32-hard-disk
 
Old 07-02-2013, 01:22 PM   #4
shaheenm
LQ Newbie
 
Registered: Jul 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Doc CPU View Post
Best advice I can give you is to try TestDisk, which is included in the repos of many Linux distros. Contrary to the name, its main purpose isn't testing a disk, but rather recovering data you thought was lost. I don't want to foster too much hope, but it's worth a try. Be prepared to face the worst, though.

[X] Doc CPU
Testdisk isnt much help, and photorec recovers files but loses all the filenames. and alot of the files are fragmented. Basically what i need to recover is my Series folder, movies folder, and a recent backup of work and downloads. my backup has word docs, source code, applications, basically a variety of files. I was hoping there would be a way to mount the image and ignore the first 2Gb so that I could access the rest. I'm trying Foremost now, hopefully that is able to provide some solution.

Thanks for the analysis though.
 
Old 07-03-2013, 10:05 AM   #5
pierre2
Member
 
Registered: May 2009
Location: Perth, AU
Distribution: LinuxMint
Posts: 338
Blog Entries: 8

Rep: Reputation: 73
something that bad, will generally require some commercial recovery software
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] syntax is everything... dd wrote to the main drive not the usb... 4n6 Linux - Newbie 3 12-10-2012 07:15 PM
Raw drive image change drive size in image? jefro Linux - General 6 10-17-2012 03:04 PM
Kernel image corrupted : Wrong Image Format for bootm command ERROR: can't get kernel blink182 Linux - Embedded & Single-board computer 0 05-13-2011 03:11 AM
Wrote to partition while making image file w/ dd: Did I mess it up? vincebs Linux - General 3 06-24-2010 08:18 AM
Using dd and gzip to create hard drive image but image is bigger than hard drive? banz Linux - Software 3 11-22-2008 04:25 AM


All times are GMT -5. The time now is 11:04 PM.

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