Piotr Roszatycki: Sorting the CDs
I'm spending the Saturday at home sorting
the CDs collection. A lot of stuff is going to trash can,
especially some warez like illegal Windows copies. I don't need
them as far as I can use Debian,
Knoppix or
Kubuntu. At least
there is a Windows 2003 Server trial which can be legally used for
180 days.
I need the backup for some CDs on harddisk. I tried to use the
K3b. Unfortunatelly, the K3b doesn't allow to choose the ISO image
file name. I had to write some tool. It uses the standard command
from mkisofs package.
By the way, I've noticed that bs parameter in dd
command has a big impact for copying speed. So I'm calling the
dd twice time. First, with a large buffer size and another
time for end of file.
The code for isocat
script:
BUFSIZE=$((128*1024))
bsize= LC_ALL=C isoinfo -d sed '/^Logical block size is:/!d; s/.*: //'
vsize= LC_ALL=C isoinfo -d sed '/^Volume size is:/!d; s/.*: //'
size=$(($bsize*$vsize))
if which pv >/dev/null 2>&1 && tty -s; then
cat="pv -s $size"
else
cat=cat
fi
( dd $ 1:+if=$1 bs=$BUFSIZE count=$(($size / $BUFSIZE)); \
dd $ 1:+if=$1 bs=$bsize
count=$(($size / $vsize - $size / $BUFSIZE * $BUFSIZE / $vsize))
skip=$(($size / $BUFSIZE * $BUFSIZE / $vsize))
) eval $cat $ 2:+> $2