やまものブログ

メモ書きブログです (^_^;A

HDD救出 ー ddrescure コマンド使用例

GNU ddrescue Manual に記載の Example 1 は模範的な使い方かもしれません。

 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

この例では、/dev/hda を /dev/hdb へコピー(救出)します。

ddrescue を2回実行しているのは、
・1回目 … 難易度の低い部分をまず救出
・2回目 … 1回目に救出できなかった部分をリトライ3回で念入りに救出
という段階を踏んだ効率のよい処理をするためです。
logfile の指定により、2回目は1回目で処理済みの部分を判別できるようです。

各オプションの意味はそのまま抜粋ですが下記のとおり。

`-f'
`--force'

    Force overwrite of outfile. Needed when outfile is not a regular file, but a device or partition.

`-n'
`--no-split'

    Skip the splitting phase. Avoids spending a lot of time trying to rescue the most difficult parts of the file.

`-d'
`--direct'
    Use direct disc access to read from infile, bypassing the kernel cache. (Open the file with the O_DIRECT flag). Use it only on devices or partitions, not on regular files. Sector size must be correctly set for this to work. Not all systems support this.

`-r n '
`--retries= n '
Exit after given number of retry passes. Defaults to 0. -1 meansinfinity. Every bad sector is tried only one time per pass. To retry badsectors detected on a previous run, you must specify a non-zero numberof retries.


本件、この記事の1つ前に書いているノートPCのHDD障害に使いたく調べました。
その障害では、残念ながら1回目の ddrescure が2日かかっても終了せず、諦めました。
HDDは100GBで、logfile は 1776行出力されています。これが諦めるに十分な判断基準になるのかどうかは分かりませんが
この logfile の続きを後日継続するかもしれませんし、あるいは、別の障害で使えるかもしれないのでメモ書き残しました