I have a scratched data CD containing one .avi file. Using normal copying methods on Linux and Windows ended up with errors. I found a hopefully helpful script on http://mail.plug.linux.org.au/piperm...t/056306.html.
I copied the script to a text file: unscratch and copied it to /usr/local/bin.
[root@localhost cdrom]# chmod +x /usr/local/bin/uscratch
[root@localhost cdrom]# vim /usr/local/bin/uscratch
BYTES==`fdisk -l /dev/hdc | grep Disk | cut -f2 -d"," | cut -f2 -d" "`
BLOCKS=`dc -e "$BYTES 512 / p"`
while [ "$POS" -le "$BLOCKS" ] ; do
while [ ! "$RETRY" -eq "0" ] ; do
COPIED=`dd if=/dev/hdc of=/mnt/sdab/etc/tmp/test.iso seek=$POS skip=$POS count=$COUNT 2>&1 | grep "records out" | cut -f1 -d"+"`
echo -n Copied $COPIED blocks from $POS " "
if [ "$COPIED" -ne "$COUNT" ] ; then
echo Copied not equal to count!
if [ "$POS" -ne "$BLOCKS" ] ; then
echo And were not at end of disc
else echo Yahoo!!! End of disk!
else let RETRY=0
if [ "$COPIED" -eq "0" ] ; then
echo with Result $RETRY and $RCOUNT retries
if [ "$RCOUNT" -ge "50" ] ; then
echo Ctrl-S here to clean disk
eject -t /dev/hdc
[root@localhost bin]# uscratch
Disk /dev/hdc doesn't contain a valid partition table
/usr/local/bin/uscratch: line 1: dc: command not found
/usr/local/bin/uscratch: line 7: [: : integer expression expected
I do not know how to correct these errors as i am a complete newbie to scripts. The CD was well mounted when i ran the script.