LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-01-2015, 01:00 PM   #1
student1
LQ Newbie
 
Registered: Jan 2008
Posts: 27

Rep: Reputation: 0
How do I recover data from lost partition


Booted my computer with 2 USB flash drives inserted. One of the drives turned out to be an MS-DOS boot drive. The PC booted in DOS and wiped out the partition table of the other flash drive with my data on it. This second (64Gb) drive had a single 64Gb type 83 (Linux) primary partition (ext4 file system).

Is there a way to recover the data that's on the second stick?

I've been told that all I have to do is repartition it exactly as it was and my data will be there. But I'd like to have advice from the pros here before I start messing with it.

For the time being, I dd-ed the entire stick, as is, onto a blank partition of my hard disk (dd if=/dev/sdb of=/dev/sda14). The process completed without errors but /dev/sda14 is unmountable for the moment.

Thanks for any help.
 
Old 02-01-2015, 01:04 PM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You should instead dd it to file so that you can re dd it to usb.

Can you give the exact way you/dos wiped out the drive?
 
1 members found this post helpful.
Old 02-01-2015, 01:21 PM   #3
student1
LQ Newbie
 
Registered: Jan 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by veerain View Post
You should instead dd it to file so that you can re dd it to usb.

Can you give the exact way you/dos wiped out the drive?
Thanks.

Not sure I know how to dd it to a "file"

I don't know "how" DOS wiped it out. After I realised what had happened, I rebooted the Linux partition (without the offending DOS stick this time). fdisk -l reported no partitions on the data stick.
 
Old 02-01-2015, 01:44 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
Quote:
Not sure I know how to dd it to a "file"
Code:
dd if=/dev/sdb of=~/usb.img
This command will create a file that contains an image of the USB drive.

Install Testdisk on your Linux system, a tool specifically designed for cases like yours. It will scan the USB device and re-create the partition table based on its findings. If this doesn't work (which it should, if only the partition table was wiped), it also brings the Photorec program, which is used to do file based recovery.

Last edited by TobiSGD; 02-01-2015 at 01:46 PM.
 
2 members found this post helpful.
Old 02-01-2015, 08:32 PM   #5
student1
LQ Newbie
 
Registered: Jan 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Smile

Testdisk worked! Thank you both; you saved my bacon today. After sussessful copy, I repartitioned the stick as it was, and sure enouh, all my files were there. So now I have both the original and the copy.
 
  


Reply

Tags
partition table


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
How do you recover data from lost partition? Exeis Linux - Hardware 9 12-19-2007 04:46 PM
Recover Lost Data VeryConfused General 5 08-30-2007 01:01 PM
Howto recover lost and formatted data on lost partitions. Sören Schneider LinuxQuestions.org Member Success Stories 2 04-05-2006 06:38 AM
How to recover data on lost partitions Red Squirrel General 12 03-20-2004 12:37 PM
Data Lost! Is It Possible To Recover? rddreamz Linux - Newbie 3 11-17-2003 10:15 PM


All times are GMT -5. The time now is 02:07 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration