DVD/CD data recovery

Antonios Christofides anthony at itia.ntua.gr
Thu Nov 17 11:07:35 EET 2005


Δεν ήξερα ότι υπάρχουν αυτά τα προγραμματάκια που έχουν αναφερθεί, και
είχα φτιάξει το δικό μου, ένα χαζό shell script που κάνει retries, αν
δεν πετύχουν τα retries κάνει eject και ξαναφορτώνει, κλπ.  Είμαι
σίγουρος ότι αυτά που αναφέρετε θα το κάνουν πολύ καλύτερα, παρόλα
αυτά περιλαμβάνω το δικό μου για λόγους πληρότητας.

-------------- next part --------------
#!/bin/bash
# Copies a dvd to an image on the hard disk, retrying whenever there
# is an error.
#   copydvd skip prefix
# 'skip' is how many 1k blocks to skip; prefix is file prefix; if
# prefix is foo, files will be foo-000.img, foo-001.img, etc. Whenever
# there is an error, copydvd retries starting a different file. At the
# end, concatenate all files together and you are ready.

DVDDEVICE=/dev/dvd
TMPFILE=/tmp/copydvd.tmp
skip=$1
prefix=$2
curnum=0
retry=0
superretry=0
filename=$prefix-`printf "%03d" $curnum`.img
while echo "Attempting position $skip, attempt $(( $retry + 1 )), file $filename..."; ! dd if=$DVDDEVICE of=$filename bs=1k skip=$skip 2>$TMPFILE; do
    cat $TMPFILE
    amountread=`grep 'records in' $TMPFILE | awk -F+ '{ print $1 }'`
    if [ "$amountread" = "" ]; then amountread=0; fi
    if [ $amountread -eq 0 ]; then
        retry=$(( $retry + 1 ))
        if [ $retry -eq 3 ]; then
            eject $DVDDEVICE
            retry=0
            superretry=$(( $superretry + 1 ))
            if [ $superretry -eq 10 ]; then
                # We don't seem to be making any progress; leave
                # ejected for 5 minutes to cool down
                superretry=0
                sleep 300
            fi
        fi
        continue
    fi
    retry=0
    skip=$(( $skip + $amountread ))
    curnum=$(( $curnum + 1 ))
    filename=$prefix-`printf "%03d" $curnum`.img
done
cat $TMPFILE
eject $DVDDEVICE


More information about the Linux-greek-users mailing list