[mythtv-users] Hard drive failure -- recovery method suggestions

Stephen Worthington stephen_agent at jsw.gen.nz
Fri Apr 17 10:51:08 UTC 2015


On Fri, 17 Apr 2015 05:31:25 -0400, you wrote:

>I am currently out of town, so I don't know too many details.  My 3 TB
>Seagate drive had a few bad sectors on one day, and then about 12 hours
>later, the drive was mounted as read-only.  It is my only media hard drive.
>
>The first thing I did was to reboot the machine, which I know was a
>mistake, but I had not had much sleep.  The machine seems to be stuck in
>the boot process, probably at a system maintenance prompt, as I can no
>longer access it remotely.
>
>My question is, what tools are recommended for recovery?  I have a feeling
>that a lot of the files are trashed due to the speed of the failure of the
>drive.  Would testdisk be an option?  I would prefer something automated if
>possible.  Or I could try a more aggressive option.
>
>The data is not critical to me.  I figured it would fail at some point, but
>I was hoping to be home when it did.  If I lose 100% of it, I suppose I can
>pick it up in reruns.  That is the "bright side".
>
>I will have to wait about a week before I can begin testing, so
>unfortunately I have no other data to go on.
>
>Suggestions are very much appreciated!
>
>Thanks!
>Jerry

I have used Gnu ddrescue many times for recovering things from failing
hard disks (and optical media).  It works very well, but is only a
command line program.  There is also another program of the same name
but different spelling, dd_rescue which is completely different
software and does not work as well.  On Ubuntu, install the gddrescue
package.  There is likely a live boot image out there that will have
it installed, or you can set up networking in the Ubuntu live images
and install it to RAM to use it.

I recommend not doing anything with the bad drive until you have the
new one you are going to copy things to.  Get it set up so that you
can access both the new and old drive at the same time and then get
ddrescue to copy things.  There are two basic approaches - rescuing an
entire partition, or rescuing individual files.  The entire partition
approach is best for boot or system partitions where there are only a
few bad sectors.  For recording partitions, I recommend using a script
that runs ddrescue on each file individually in turn, something like
this:

#!/bin/bash

source=/mnt/bad/recordings
dest=/mnt/new/recordings
cd $source
for a in * ; do
    #echo $a
    ddrescue -v "$source/$a" "$dest/$a" "$dest/$a.log"
done

Once ddrescue has rescued all the files it can with the default
settings, you can check the log files to find out which ones it is
still having trouble with and retry them with more intensive retries.

My experience with several drives doing exactly as you described is
that they can be failing in random sectors all over the disk, but I
have also had one where the failure was localised and I lost lots of
sectors in only a few recording files.  The latter is the best case -
I only lost six files from a 2 Tbyte drive.  I have also had drives
failing where they were not too far gone and the repeated tries by
ddrescue were able to copy most files.

Depending on how bad things are, it can take ddrescue several days to
recover whatever is recoverable.  So if you want to record things
while that is happening, you may need to set things up so that the
disks you are recovering with are run from a new working system which
has a boot partition and some recording space.  Running ddrescue works
just fine alongside normal use of a MythTV box.  Or you can do the
recovery on another PC entirely - I have used my laptop with two
external drive mounts.


More information about the mythtv-users mailing list