Fedora Linux Support Community & Resources Center
  #1  
Old 30th June 2009, 09:51 PM
Christoffur Offline
Registered User
 
Join Date: May 2009
Posts: 15
Smart hard drive repair and data recovery using dd if=/dev/sda

I have a couple of hard drives with bad sectors.

They both held root partitions for different Red Hat systems on sda3.

One was Fedora3, and the other was an old Red Hat Linux 8.0 (Psyche).

I copied the flaky partitions using "dd if=/dev/sda3 of=sda3 bs=512 conv=noerror,notrunc,sync" and then was able to mount the copies and run fsck to see what is going to be lost when the system tries to fixup the filespace.

There were literally thousands (1,200+) bad sectors on each drive, and likewise a similar amount of inodes stuck in lost+found with no filename reference except for the inode number.

I made a second copy using dd and noticed that some of the bad sectors previously "not" copied were successfully repaired and copied intact on the second pass.

So I captured the dd error messages "dd: reading '/dev/sda3': Input/output error", xxxxxx+nnn records in, xxxxxxxxx+0 records out... to a file and am using that to hammer away at getting just the bad blocks off of the drive.

This has been running for three or four days now, and seems to have hit a brick wall. It is painfully slow reading only 3 or 4 sectors per minute and is taking about 6 hours to do one pass over the bad blocks.

So far I have successfully converted less than a hundred bad blocks into good blocks.

*
***
*****

The problem is... when reading the so-called bad blocks, the only data I get are empty (fully zeroed) data blocks. Certainly there is some data on the disk drive, and I want to retrieve all of my data... errors or not.

Does anyone know how to turn off the ide, and sata, block error checking so I can get at the bad data? It would also help if we could speed things up by reducing the bad sector time-out if possible.


Additionally the smart drives are apparently doing autoreallocates when possible on the bad sectors. Is there a way to back track and retrieve the "bad data" off of the old reallocated sectors?

Regards from,
Chris
Reply With Quote
  #2  
Old 30th June 2009, 10:12 PM
Christoffur Offline
Registered User
 
Join Date: May 2009
Posts: 15
Smart hard drive repair and data recovery using dd if=/dev/sda

Sorry I forgot to mention that I am running these drives on Fedora10 now using the 2.6.27.24 kernel.

I believe that the kernel is using the new sata / ide drivers on one machine that has the intel ich5 chipset and a p4 cpu.

The the other computer is a p2 with the 440LX chipset and is has both the old and new MPIIX, drivers as well as the generic ATA drivers compiled in.
Reply With Quote
  #3  
Old 30th June 2009, 11:11 PM
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
use safecopy instead of dd, it skips i/o errors automagically

Code:
yum install safecopy
see the HOW TO section in the man page of safecopy for examples.

There's also the even more advanced, ddrescue, it doesn't have a man page but does have a comprehensive info page, 'info ddrescue'

Code:
yum install ddrescue
Reply With Quote
  #4  
Old 30th June 2009, 11:48 PM
Christoffur Offline
Registered User
 
Join Date: May 2009
Posts: 15
Smart hard drive repair and data recovery using dd if=/dev/sda

Ok thanks. I'll try giving safecopy a workout first.
Reply With Quote
  #5  
Old 2nd July 2009, 07:59 AM
Christoffur Offline
Registered User
 
Join Date: May 2009
Posts: 15
Smart hard drive repair and data recovery

Ok. I've been running safecopy for a couple of days now, but the same problem is still occurring.

I am not getting any data at all when an error occurs on the hard disk!!!!

The blocks are completely zeroed out, and there is nothing to check or compare to verify what part of the sector has gone bad, or to tell what the read head picked up off of the media.

Safecopy is ok, but like dd it is only storing blocks with successfull reads. It doesn't seem to be doing any data analysis on the errored sector.

Reads to a hard drive sector should return data instead of a block of zeroes.

Isn't there a simple way to force some kind of a low level read of the data sector, and actually get at the true / corrupt data stored on the drive?

Thanks from,
Chris
Reply With Quote
  #6  
Old 2nd July 2009, 09:08 AM
sideways Offline
Retired User
 
Join Date: Oct 2004
Location: London, UK
Posts: 4,999
If you read the man page for safecopy it will tell you how to use it in different modes, including ones that to not zero out the bad data but mark the position with a string for further analysis on a second scan.

Similarly with ddrescue, read the info manual thouroughly to understand what options for recovery are available.

You seem to want to do the impossible - recover data from damaged sectors of a drive.

There are some tools which attempt a statistical analysis of multiple reads of bad sectors, and then "guess" what the data should have been - this is mostly useless of course, but if you want to try it have a look at SpinRite. I've partially recovered text documents from floppy disks with it, but nothing more.
Reply With Quote
  #7  
Old 2nd July 2009, 09:58 AM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,935
A/ I learned some new tools here - thanks Sideways.
B/ What exactly would you prefer in place of zeroes ???
Examine "hdparm --read-sector nnnn" but you should expect some problems anyway.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #8  
Old 2nd July 2009, 01:49 PM
kyryder
Guest
 
Posts: n/a
SpinRite can be found at Gibson Research Co. and has been around for a long time but Steve is always making it better. I remember using it in the eighties with great success.
Reply With Quote
  #9  
Old 2nd July 2009, 07:00 PM
Christoffur Offline
Registered User
 
Join Date: May 2009
Posts: 15
Smart hard drive repair and data recovery using dd if=/dev/sda

Yes thanks again. I forgot about hdparms.

I read the man and info pages for both ddrescue and safecopy. The idea for writing CoRrUpT into all of the bad sectors is cute, but it only helps to identify what files are bad. It doesn't actually help to analyze the nature of the disk error.

The idea of skipping out of the danger zone when an error occurs is also good, but again valuable data was actually read by the read heads when the error occurred, and it should be stored and saved for future evaluation and analysis.

If I have been doing 20 passes over a bad spot on disk, it does me more good to save all 20 reads, or in the case where 8 retries were attempted for each read, I would have 160 sectors of live data to analyze and do either a statistical analysis of, or I could evaluate further the context wherein the data were placed on the disk and the form in which it was retrieved.

Right now, I have made 160 "useless" passes over the worst bad spots on the drive.

According to the documentation this was probably not a wise thing to do since I didn't get any value for my effort, and could have in fact damaged the file / data / drive further.

If I had something other than zeroes to look at, I might have made a different decision.

*
***
*****

I'm not saying that linux is doing the wrong thing by returning zeroes on a bad sector read as far as operating system data integrity is concerned. I fully concurr that returning zeroes is probably better than returning garbage, and having some user software, or worse the OS go haywire trying to process junk data.

But on the other hand, destruction of data is a crime, and the willfull destruction of data is a felony punishable by some amount of years in prison and / or a fine of up to some amount of U.S. currency or legal tender.

Sending me zeroes instead of data.... is a crime.
Reply With Quote
Reply

Tags
data, drive, hard, if or dev or sda, recovery, repair, smart

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Recovery from USB Drive wjdearborn Installation, Upgrades and Live Media 4 16th June 2014 09:46 AM
LVM Hard Drive Recovery Question theMidas Using Fedora 5 20th May 2009 04:58 PM
Data recovery from LVM drive BandC Using Fedora 8 5th July 2008 08:00 AM
hard drive data kablargh Installation, Upgrades and Live Media 1 4th January 2007 07:44 AM


Current GMT-time: 22:52 (Thursday, 30-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Naksalbari Photos on Instagram - Baekrajan Travel Photos - Cambodia Instagram Photos