LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-11-2014, 10:15 PM   #1
twoski
LQ Newbie
 
Registered: Jun 2014
Posts: 10

Rep: Reputation: Disabled
Question Using Linux To Recover Data


My portable external USB harddrive recently failed, and chkdsk didn't fix the problems. So i am resorting to using Linux to recover what files i can salvage.

It has been suggested that i use ddrescue to recover the files from the drive. There are certain distros of Linux made for data recovery, would it be wiser to use one of those instead of debian which i currently have? My drive is 500gb, so i am using a virtual machine with enough space to dump all the files from the failing drive, then i will reformat the drive, then dump the files back into it.

Here is the output from dmesg when i plug the usb drive in.

http://i.imgur.com/Efaa55O.png

Here is the popup i see when it is plugged in.

http://i.imgur.com/xpzFiOl.png

As you can see, things are looking pretty sketchy. I want to save as much as possible from the drive before i reformat it.

I haven't used ddrescue before and i wanna make sure i use it properly. The manual says to do something like:

ddrescue -f -n /dev/hda /dev/hdb logfile
ddrescue -d -f -r3 /dev/hda /dev/hdb logfile
fdisk /dev/hdb
e2fsck -v -f /dev/hdb1
e2fsck -v -f /dev/hdb2

How do i figure out the location of the drive when i plug it in? I assume it would be in /dev/ somewhere? Would those commands be sufficient to recover the data? Thanks for any help.
 
Old 06-12-2014, 02:53 AM   #2
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Right now it's saying you need to run "chkdsk /f" This command won't work from linux system but you should boot a wins system & run it.
 
Old 06-12-2014, 08:48 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
The primary tools for data recovery are ddrescue, testdisk, and photorec. If you have those or can install them in your Debian system, you can use them from there.

When you plugged the drive in, the dmesg output showed that it was /dev/sdb with a single partition /dev/sdb1. If you would post the output from "smartctl -A /dev/sdb" that would give a better idea of the overall health of the drive.

ddrescue will attempt to make a sector by sector image of the failing drive, first copying all the sectors that can be read easily and then going back and making repeated efforts to copy the troublesome sectors. The process can take quite a long time. You will end up with an image that is free from I/O errors, but with all zeros filling any sectors that could not be read. You would use /dev/sdb1 as the source, and the destination would be a file or new partition elsewhere on your system. If the data is important, you should then treat that image as precious and make another, working copy elsewhere (on a new drive, or back on the old one if it is healthy enough) for your recovery efforts.

I'm not familiar with the current capabilities for checking/repairing an NTFS filesystem in Linux. It might be best to perform that step on a Windows system, and you would need to have that working image on a partition, not a file, in order to do that.

The need for using testdisk or photorec for file recovery would depend on how well chkdsk was able to repair the filesystem.
 
Old 06-12-2014, 06:37 PM   #4
twoski
LQ Newbie
 
Registered: Jun 2014
Posts: 10

Original Poster
Rep: Reputation: Disabled
Here is the output. Doesn't look very good.

http://i.imgur.com/kJPQYuI.png
 
Old 06-12-2014, 07:30 PM   #5
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
smarctl does not work over USB. I would suggest that you remove the disk from the enclosure and attach it to the internal power & sata. An external enclosure with eSATA will work too.

Before you do anything else (such as fsck) I would suggest you copy the image to a larger HDD.

Regards,
Stefan



Quote:
Originally Posted by twoski View Post
Here is the output. Doesn't look very good.

http://i.imgur.com/kJPQYuI.png
 
Old 06-12-2014, 08:28 PM   #6
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by propofol View Post
smarctl does not work over USB. I would suggest that you remove the disk from the enclosure and attach it to the internal power & sata. An external enclosure with eSATA will work too.

Before you do anything else (such as fsck) I would suggest you copy the image to a larger HDD.

Regards,
Stefan
Actually, SMART may work over USB, it depends on the enclosure. I once bought one that didn't and I took it back for one that did. However, if the disk is failing it may be wise to mount it internally because this produces faster transfer speeds and bypasses a possibly failing USB-SATA converter board.
 
1 members found this post helpful.
Old 06-12-2014, 08:51 PM   #7
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
Unless I'm not understanding all the technicalities here I often use a live version of Linux to fix or recover files e.g: Puppy that lodes to RAM so you can remove DVDRW\USB\Etc for backups...
 
Old 06-12-2014, 09:29 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by twoski View Post
Here is the output. Doesn't look very good.
As others have pointed out, the USB<=>SATA bridge chip in some enclosures does not support the SMART commands. You will need to remove the drive from the enclosure and mount it internally or in an enclosure with a compatible interface. I would get rid of your current enclosure just because it does not allow you to check on the health of the drive.
 
Old 06-13-2014, 12:36 AM   #9
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
What I don't understand is that your SystemDisk said please check me.
And you have not done so.
It's asking for a
Quote:
chkdsk /f
Which would be done thru a wins system.
 
Old 06-13-2014, 05:55 AM   #10
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
...
Code:
man fsck
 
Old 06-17-2014, 06:13 PM   #11
twoski
LQ Newbie
 
Registered: Jun 2014
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EDDY1 View Post
What I don't understand is that your SystemDisk said please check me.
And you have not done so.
It's asking for a

Which would be done thru a wins system.
I tried, but it failed at the end.

A lot of you guys are suggesting that i mount the drive internally, i'm not sure that's in the realm of possibilities since i have a laptop.

There is no obvious way to get it out of its enclosure so i'd rather not remove the enclosure unless it's my last resort.
 
Old 06-17-2014, 06:54 PM   #12
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Then just use ddrescue to image the drive to another drive at least as large as it is.
 
Old 06-17-2014, 07:40 PM   #13
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Hiren's bootcd has mini winsxp you can run chkdsk from there.
 
Old 06-17-2014, 07:56 PM   #14
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Those enclosures can be pretty tricky to open if you haven't done it before. Without some way of checking the health of the drive, I wouldn't even consider reusing it. What is the make and model.? Does the manufacturer supply any diagnostics?
 
Old 06-17-2014, 09:27 PM   #15
twoski
LQ Newbie
 
Registered: Jun 2014
Posts: 10

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
Those enclosures can be pretty tricky to open if you haven't done it before. Without some way of checking the health of the drive, I wouldn't even consider reusing it. What is the make and model.? Does the manufacturer supply any diagnostics?
I figured out how to open it, everything looks physically healthy.

I am 90% sure that the problem stems from my roommate using it and unplugging it while it was reading/writing data.

I tried running chkdsk twice on it and both times it failed at the very end so i am worried that any more attempts will cause further problems. Most of the stuff on the drive was already backed up so i am not worried about it, it would be convenient to be able to salvage a few files before i reformat though.

The drive holds 500gb and i only had about half of it filled. I made a debian virtual machine with 550gb of harddrive space, can i just run ddrescue on the drive and have it copy all the stuff to my virtual machine, then reformat the drive and dump all the recovered files back into it? Or do i need to save an image of the portable HDD to the virtual machine then run ddrescue on the image?

Last edited by twoski; 06-17-2014 at 09:31 PM.
 
  


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
[SOLVED] Recover Data from unallocated linux partition?! linus72 Linux - General 8 12-03-2009 09:41 AM
Recover data which was deleted- Linux linuxguy08 Linux - Server 2 09-10-2008 07:37 PM
Recover data from Linux shipon_97 Linux - Newbie 4 04-17-2007 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:49 AM.

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