LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-23-2014, 08:59 AM   #1
Zenock
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Rep: Reputation: 0
Help with failing hard drive


I have a failing hard drive...

I put it in an external enclosure and attached it USB.

I then tried to dd it. It got part way through but failed. Once it fails I can do nothing with the drive until I remove power from it. After doing that if I reconnect I have access to the drive again.

I used RSYNC but same thing happened. I was able to identify the high level directory it was failing on but not the low level directory or the individual file.

I excluded the high level directory it was failing at and it seems to be copying all the files now minus the ones in that particular directory. Since I haven't finished the RSYNC yet I can't be sure of that it will complete. But it has made it farther along.

However, even if RSYNC completes, there were "some things deleted on the disc that weren't suppose to be" before it failed so I feel I really need to get an image of this disk to work with.

OK my questions...

1. How would you go about identifying the precise location on the disk that is causing the disk to go wonky...

2. How would you go about making a dd image that excluded these bytes/sectors?
 
Old 01-23-2014, 11:10 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,096
Blog Entries: 10

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
How are you performing the dd? I would do the whole drive as user root and I would not have the drive mounted when I did this.

If that fails, what's it saying when it fails? This is a byte by byte copy, regardless of format problems and I'd assume that the driver would deal with un-readable sectors, but maybe I'm assuming incorrectly.

If there are sectors which are un-readable and they are not properly marked, I'm less knowledgeable about that, but I'm sure there are utilities out there which can analyze the drive and mark suspicious sectors unusable in a recognized manner so that dd wouldn't fail. I suspect dd isn't failing it's the driver can't provide dd with any information because a sector is bad and not marked as bad so that the driver knows to skip it.

A second dd option would be to still have it unmounted, but know the partitions it has and perform dd as root for each partition. Maybe that way you could grab data from each partition if there are more than one and then see if only one particular partition has the problem.

Another idea would be to determine when dd fails; I believe it will tell you how many blocks or bytes it got, or the of file is of a certain size. You can tell dd to only copy so much. To get beyond a bad sector, providing it's one sector and continuous; which I have no idea if it would work that way, I'd see if dd could start with some offset. That last part I don't know; however telling dd to only copy so many blocks is supported.

Best of luck.
 
Old 01-23-2014, 11:23 AM   #3
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,718

Rep: Reputation: 906Reputation: 906Reputation: 906Reputation: 906Reputation: 906Reputation: 906Reputation: 906Reputation: 906
You might have better luck running it internally rather than over USB.
 
Old 01-23-2014, 12:29 PM   #4
Zenock
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by rtmistler View Post
How are you performing the dd? I would do the whole drive as user root and I would not have the drive mounted when I did this.
sudo dd if=/dev/sdg conv=sync,noerror bs=64K of=drive.img

I don't have the drive mounted.

Quote:
If that fails, what's it saying when it fails? This is a byte by byte copy, regardless of format problems and I'd assume that the driver would deal with un-readable sectors, but maybe I'm assuming incorrectly.
It repeatedly throws an access error of some type. I wish I had captured it. I will have to start it again to find out the precise error. It's weird. It's like the error state exists on the drive itself and the drive decides it's not going to do anything after it happens. I can't even mount the drive and browse it after the error occurs. The drive just stops working as apposed to a "woops that was a bad sector" type error.

Quote:
If there are sectors which are un-readable and they are not properly marked, I'm less knowledgeable about that, but I'm sure there are utilities out there which can analyze the drive and mark suspicious sectors unusable in a recognized manner so that dd wouldn't fail. I suspect dd isn't failing it's the driver can't provide dd with any information because a sector is bad and not marked as bad so that the driver knows to skip it.
Except the drive won't work at all after it hits the bad area until I power it down completely and bring it back up. Same is true with dd or rsync. The drive just stops working. Note when I excluded the high level directory that seemed to be causing the issue, rsync did finish.

Quote:
A second dd option would be to still have it unmounted, but know the partitions it has and perform dd as root for each partition. Maybe that way you could grab data from each partition if there are more than one and then see if only one particular partition has the problem.
I will give that a try as a method to try to find where it's failing.

Quote:
Another idea would be to determine when dd fails; I believe it will tell you how many blocks or bytes it got, or the of file is of a certain size. You can tell dd to only copy so much. To get beyond a bad sector, providing it's one sector and continuous; which I have no idea if it would work that way, I'd see if dd could start with some offset. That last part I don't know; however telling dd to only copy so many blocks is supported.
Yeah that's what I want. I want dd to STOP when it hits the error and tell me how far it got. I know dd can start with an offset so once I find where it's at I should be able to to dd up to where it errors then dd with offset and seek after the error.

Quote:
Best of luck.
Thanks.

Quote:
Originally Posted by cascade9
You might have better luck running it internally rather than over USB.
I actually did it both ways. Just putting it in the external case over USB became more practical with having to power down the drive to get it to run again.

Thank you.

Z
 
Old 01-23-2014, 12:53 PM   #5
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
I would not power on/off that much, have you considered the HD circuit board is having problems too? Did you run a test to see the actual drive health status? gnome-disk-utility/palimpsest for example can give somewhat detailed information about the drive.

Regards
 
  


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
Is my Hard Drive Failing? kitek Linux - Server 5 05-28-2011 09:16 PM
Failing Hard Drive Tuxqi Linux - Hardware 12 10-27-2009 05:18 AM
Possible failing hard drive? ub3rj3phf *BSD 4 11-04-2008 01:27 PM
hard drive failing, how can I create an image of my drive? oily_rags SUSE / openSUSE 6 07-07-2005 03:19 PM
Is my hard drive failing? HGeneAnthony General 1 11-23-2004 02:37 AM


All times are GMT -5. The time now is 08:30 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