1) J'étais paumé (et le suis encore en grande partie) dans la centaine de lignes du chapitre "9 Fill mode" :
9 Fill mode
***********
When ddrescue is invoked with the `--fill-mode' option it operates in
"fill mode", which is different from the default "rescue mode". That
is, if you use the `--fill-mode' option, ddrescue does not rescue
anything. It only fills with data read from the input file the blocks of
the output file whose status character from the logfile coincides with
one of the type characters specified as argument to the `--fill-mode'
option.
In fill mode the input file may have any size. If it is too small,
the data will be duplicated as many times as necessary to fill the input
buffer. If it is too big, only the data needed to fill the input buffer
will be read. Then the same data will be written to every cluster or
sector to be filled.
Note that in fill mode the input file is always read from position
0. If you specify a `--input-position', it refers to the original input
file from which the logfile was built, and is only used to calculate the
offset between input and output positions.
Note also that when filling the input file of the original rescue run
you should set `--input-position' and `--output-position' to identical
values, whereas when filling the output file of the original rescue run
you should keep the original offset between `--input-position' and
`--output-position'.
The `--fill-mode' option implies the `--complete-only' option.
In fill mode the logfile is updated to allow resumability when
interrupted or in case of a crash, but as nothing is being rescued the
logfile is not destroyed. The status line is the only part of the
logfile that is modified.
The fill mode has a number of uses. See the following examples:
Example 1: Mark parts of the rescued copy to allow finding them when
examined in an hex editor. For example, the following command line fills
all blocks marked as `-' (bad-sector) with copies of the string
`BAD SECTOR ':
printf "BAD SECTOR " > tmpfile
ddrescue --fill-mode=- tmpfile outfile logfile
Example 2: Wipe only the good sectors, leaving the bad sectors alone.
This way, the drive will still test bad (i.e., with unreadable sectors).
This is the fastest way of wiping a failing drive, and is specially
useful when sending the drive back to the manufacturer for warranty
replacement.
ddrescue --fill-mode=+ --force /dev/zero bad_drive logfile
Example 3: Force the drive to remap the bad sectors, making it usable
again. If the drive has only a few bad sectors, and they are not caused
by drive age, you can probably just rewrite those sectors, and the drive
will reallocate them automatically to new "spare" sectors that it keeps
for just this purpose. WARNING! This may not work on your drive.
ddrescue --fill-mode=- --force --synchronous /dev/zero bad_drive logfile
Fill mode can also help you to figure out, independently of the file
system used, what files are partially or entirely in the bad areas of
the disc. Just follow these steps:
1) Copy the damaged drive with ddrescue until finished. Do not use
sparse writes. This yields a logfile with only finished (`+') and
bad-sector (`-') blocks.
2) Fill the bad-sector blocks of the copied drive or image file with
a string not present in any file, for example "DEADBEEF".
3) Mount the copied drive (or the image file, via loopback device).
4) Grep for the fill string in all the files. Those files containing
the string reside (at least partially) in damaged disc areas.
5) Unmount the copied drive or image file.
6) Optionally fill the bad-sector blocks of the copied drive or image
file with zeros to restore the disc image.
Example 4: Figure out what files are in the bad areas of the disc.
ddrescue -b2048 /dev/cdrom cdimage logfile
printf "DEADBEEF" > tmpfile
ddrescue --fill-mode=- tmpfile cdimage logfile
rm tmpfile
mount -t iso9660 -o loop,ro cdimage /mnt/cdimage
find /mnt/cdimage -type f -exec grep "DEADBEEF" '{}' ';'
umount /mnt/cdimage
ddrescue --fill-mode=- /dev/zero cdimage logfile
File: ddrescue.info, Node: Generate mode, Next: Ddrescuelog, Prev: Fill mode, Up: Top
2) Au passage, je comprends l'intérêt de "DEADBEEF" :
c'est juste que, comme ça forme en caractères hexa deux mots anglais,
a) c'est inscriptible sur les bits d'un machin non monté ;
b) ça sautera aux yeux quand on relira avec un éditeur hexa ;
c) huit caractères consécutifs, c'est un marqueur suffisamment long pour éviter des coincidences.
3) Cherchant à comprendre le signe "moins" final dans ton "--fill-mode=-",
je tombe enfin sur ce semblant de définition :
blocks marked as `-' (bad-sector)
Donc
OK, ta commande va bien mettre des zéros dans la
copie des
mauvais secteurs (tels que recensés dans ~/log-ddrescue).
Je suis... laborieusement ! 😃
4) P.S. : Si cqfd93 peut trouver 320 Go de libres quelquepart, j'aimerais bien qu'on fasse une
copie de sécurité de l'actuelle /dev/disk/by-id/wwn-0x50014ee256cb3e57 avant d'y toucher.
Sinon on travaille sans filet !
Parce que, en cas de pépin, je doute que le disque défectueux supporte aussi bien que la première fois les passages de ddrescue.