Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 02-04-2015, 03:14 PM   #1
LQ Newbie
Registered: Feb 2015
Posts: 1

Rep: Reputation: Disabled
ddrescue & bad sector recovery

In the span of 2 years I've owned my w7 laptop (that I bought new from mfg) its turned off by itself suddenly maybe 5 times. Just yesterday I can't even complete a backup without getting disk i/o errors and remembered that some months ago I wasn't able to copy a large collection of files without getting I/o errors also (but didnt think nothing of it and just did a backup instead).

Chkdsk /f completes without any errors.*
Chkdsk /r hanged up for at least an hour in a specific number progression which would in intervals freeze my computer and manually cancelled the process when I read somewhere it may do more harm then good.

I am assuming my disk is in trouble and some searches led me to believe I should:

Clone my whole disk to external usb file with ddrescue:

ddrescue --no-split /dev/hda image.img logfile.log

ddrescue --direct --max-retries=3 /dev/hda image.img logfile.log

ddrescue --direct --retrim --max-retries=3 /dev/hda image.img logfile.log

?? 2. ?? Use a bad sector recovery tool if I get errors on imaging critical files with : hddregenerate, getdataback, spinrite 6.0, DMDE, or just allow chkdsk /r complete and possibly save whatever was missed by ddrescue

Restore my image file to a NEW laptop disk:

ddrescue -f image.img /dev/hda restore.log

?? 4. ?? Run chkdsk /b on new disk

Side comments: This is my first time ever having to do this. I'm decided to imaging w ddrescue first then I MIGHT do any lengthy & potentially harmful bad sector "fix" attempts later depending on how much CRITICAL data ddrescue images.


?? 2. ?? Will ddrescue's log file inform me of the specific file and folder on bad sector that wasnt copied in first run?? ??*
Does second ddrescue command do the same kind of work mentioned bad sector recovery software does making using any of those tools idiotic and redundant??*
which of those mentioned tools would allow me to specifically target recovery on problem area on a folder/file or sector level and/or can restart recovery attempt??*
I dont want to have to wait hours upon hours for diagnostics performed on sections of a disc I already got my data from, with a 500gb disk this will be a nightmare. ASAIK chkdsk & spinrite are out of the question for any time saving specific target strategies.

?? 4. ?? I read somewhere imaging software will copy bad sectors which IMO doesn't logically coincide with why other steps are performed and you should do a chkdsk /b on a new disk after image has been restored to new disk. Im not in too much of a position to critique since I dont have the slightest idea, none of these steps are in any way my own original thoughts but I have my doubts for this step.

Im asking this question from a handset and waiting for responses before starting, thanks.
Old 02-05-2015, 02:29 AM   #2
Senior Member
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You should use ddrescue as baseline backup. The areas where the sector are bad it just fills them with 0. Be careful to preserve log.
Old 02-05-2015, 12:16 PM   #3
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,786

Rep: Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215Reputation: 2215
ddrescue has no knowledge of filesystem structure. It just copies the whole drive or partition block-by-block. Once you know which sectors are bad, you can do some caclulation to map the sector address to a filesystem block number and then use the debugfs icheck and ncheck requests to find out which inode and filename claim that block. The procedure is outlined in the Bad block HOWTO, and is fairly tedious if you have more than a few bad blocks. You will probably want to do that on the ddrescue-ed image so that debugfs doesn't get hung up on disk retries on the bad sectors.

An alternative to finding all the files with bad blocks is to simply try to read all of them and see which ones fail with I/O errors:
find / -xdev -type f -exec cat {} \; >/dev/null
You need the "-xdev" to keep find from digging into /proc, /sys, and the like, so you'll need to run that for each separate filesystem. You will need to do that on the failing disk, not on the image, and it's going to take a while since it will be delayed by retries on the I/O errors.


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
Creating DDrescue data recovery software GUI using QT tool and runnig it in linux ve sauravait Programming 2 02-17-2013 08:00 AM
Slow ddrescue recovery problem (slow reads? excessive retries?) mventimi Linux - General 4 09-22-2010 07:03 PM
Data recovery - photorec vs. testdisk vs. ddrescue? JStevenson Linux - Newbie 7 09-01-2009 03:27 PM
Data recovery with ddrescue Matistimo Linux - Newbie 7 11-30-2007 07:15 AM
Advice needed: data recovery from NTFS disk using ddrescue and Ubuntu afzal_b Linux - Newbie 10 09-20-2006 09:14 AM > Forums > Linux Forums > Linux - Software

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration