Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Sep 1997 23:55:45 +0200 (MESZ)
From:      Robert Eckardt <roberte@MEP.Ruhr-Uni-Bochum.de>
To:        hai@genesis4.sps.mot.com (Hai N)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: CD Copy to worm device.
Message-ID:  <199709222155.XAA01626@ghost.mep.ruhr-uni-bochum.de>
In-Reply-To: <3426D983.41C67EA6@genesis4.sps.mot.com> from Hai N at "Sep 22, 97 01:48:03 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
It was Hai N who wrote:
> Hello all,
>  I have a simple question that perhaps someone can help me with.
>  Can I use the dd command to copy files from a CD to a CD-R ?  I would
> like to make backup copies for some of my CD(s).
> 
>  Would the below command work :
>  dd if=/dev/cd0a of=/dev/worm0 bs=1024

No.

If your CDROM is fast enough and you have team installed, you might
find the following script for data CDs useful:
(cdio used to be necessary under 2.1.5/7 to reset the WORM, it ejects
 and inserts the tray -- it doesn't hurt under 2.2.2 -- check its path.)
(Also, remember not to distribute your backups to friends, unless
 allowed by copyright conditions.)

8<---8<---------------------------------------------------------------------
#!/bin/sh
#
# file:  burncd
#
# written by:  Darryl Okahata <darrylo@sr.hp.com>
# modified by: Robert Eckardt <roberte@mep.ruhr-uni-bochum.de>
#
# Used to control the writing process of data to a CD-R.
# Writes CD image (tested only cd9660-FS image) to the WORM.

usage()
{
	echo "usage:  `basename $0` [-bcsdovh] input-file"
	echo "	-b : do actually burn the CD, dummy run otherwise"
	echo "	-c : copy CDs"
	echo "	-s : use single speed"
	echo "	-d : use double speed (default)"
	echo "	-o : use \`onp' on fixate (untested)"
	echo "	-v : verbose, show each step"
	echo "	-h : help, show this message"
	exit 1
}

error()
{
	echo "`basename $0`: $1"
	exit 1
}


# Uncomment this for the HP4020i:
VENDOR=HP
MODEL=4020i
# Uncomment this for the Plasmon RF4100:
#VENDOR=PLASMON
#MODEL=RF4100

# Defaults:
dummy="dummy"
speed="double"
onp=""
verbose="off"
copy="false"
file_defined="no"
file="/dev/rcd0c"

set -- `getopt "bcsdovh" $*`
if [ $? != 0 ]; then
	usage
else
	for i
	do
		case "$i"
		in
			"-b")	dummy="";;
			"-s")	speed="single";;
			"-d")	speed="double";;
			"-c")	copy="yes"; file_defined="yes";;
			"-o")	onp="onp";;
			"-v")	verbose="on";;
			"-h"|"-?")	usage;;
			"--")	;;
			*)	if [ "$file_defined" = "yes" ];then
					error "only one file name allowed"
					exit 1
				else
					file=$i
					file_defined="yes"
				fi;;
		esac
		shift
	done
fi
if [ "$file_defined" = "no" ]; then
	usage
#elif [ ! -f $file ]; then
#	error "\`$file' is not a valid file."
#	exit 1
elif [ "`id -u`" != "0" ]; then
	error "Sorry, this must be done as root."
	exit 1
fi

if [ "$dummy" = "dummy" ]; then
	echo "Will only do a dummy run."
else
	echo "***  Attention: Will actually burn the CD-R !  ***"
fi

echo -n "Place a blank CD in the writer and press return: "
read junk

if [ "$verbose" = "on" ]; then
	echo "-- reset and select $VENDOR $MODEL"
fi
scsi -f /dev/rworm0.ctl -c "0 0 0 0 0 0" >/dev/null 2>&1
wormcontrol select $VENDOR $MODEL

if [ "$verbose" = "on" ]; then
	echo "-- prepdisk $speed $dummy"
fi
# Change "double" to "single" to burn at single-speed.
wormcontrol prepdisk $speed $dummy

if [ "$verbose" = "on" ]; then
	echo "-- track data"
fi
wormcontrol track data

if [ "$verbose" = "on" ]; then
	echo "-- writing data to WORM"
fi

if [ "$copy" = "yes" ]; then
	rtprio 5 dd if=$file ibs=32k | \
	rtprio 5 team -v 1m 5 | \
	rtprio 5 dd of=/dev/rworm0 obs=20k
else
	rtprio 5 team -v 1m 5 < $file | rtprio 5 dd of=/dev/rworm0 obs=20k
fi

if [ "$verbose" = "on" ]; then
	echo "-- fixate 1 $onp"
fi
wormcontrol fixate 1 $onp

if [ "$verbose" = "on" ]; then
	echo "-- process finished."
fi

/root/bin/cdio

echo -n "Please remove the CD-R from the drive now and press return. "
read junk
8<---8<---------------------------------------------------------------------
#!/bin/sh

scsi -f /dev/rworm0.ctl -s 60 -c '1b 0 0 0 2 0'
sleep 5
scsi -f /dev/rworm0.ctl -s 8 -c '1b 0 0 0 3 0'
8<---8<---------------------------------------------------------------------


It is called (by root) simply as
    `burncd -b -c'
or
    `burncd -b CDROM-Image-File'.

It works for me with an hp4020i (WORM) and a Toshiba 3701 (7x CDROM).
Try a dummy run first to verify that you can indeed read all of the
source CD !

Robert

-- 
Robert Eckardt                \\ FreeBSD -- solutions for a large universe.(tm)
RobertE@MEP.Ruhr-Uni-Bochum.de \\       What do you want to boot tomorrow ?(tm)
http://WWW.MEP.Ruhr-Uni-Bochum.de/~roberte
For PGP-key finger roberte@gluon.MEP.Ruhr-Uni-Bochum.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709222155.XAA01626>