Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

burncd - verify burn

0 views
Skip to first unread message

Brian Henning

unread,
Jul 25, 2005, 1:11:35 PM7/25/05
to freebsd-...@freebsd.org
Greetings:

I would like to know a process to verify that I my cd burner has
burned an ISO file correctly with burncd. I know I can take some
precautions like checking the md5sum of the iso during a transfer from
the Internet. I also read on the Internet that burncd does puts some
extra padding at the end of the cd. I am not sure if that is true or
not. Could someone tell me how to verify a cd burn?

Thanks,

Brian

Glenn Dawson

unread,
Jul 25, 2005, 1:38:31 PM7/25/05
to Gary W. Swearingen, Brian Henning, freebsd-...@freebsd.org
At 10:38 AM 7/25/2005, Gary W. Swearingen wrote:
>Here's a crummy script I just used to burn and verify a CD, but I've
>only tested it with the "cdrecord" setup. Older versions of it worked
>with "burncd" on older OS versions, but I can tell you that the reason
>I'm using "cdrecord" is that my manual efforts to do this with
>"burncd" on 5.4-RELEASE (and maybe 5.4-STABLE a couple weeks ago)
>failed, because I couldn't "dd" a CD burned with "burncd". (IE, I
>couldn't sucessfully "dd" /dev/acd0, while I could "dd" /dev/cd0).

did you use bs=2048 when dd'ing from /dev/acd0?

-Glenn

Gary W. Swearingen

unread,
Jul 25, 2005, 1:38:01 PM7/25/05
to Brian Henning, freebsd-...@freebsd.org
Brian Henning <brian....@gmail.com> writes:

Here's a crummy script I just used to burn and verify a CD, but I've


only tested it with the "cdrecord" setup. Older versions of it worked
with "burncd" on older OS versions, but I can tell you that the reason
I'm using "cdrecord" is that my manual efforts to do this with
"burncd" on 5.4-RELEASE (and maybe 5.4-STABLE a couple weeks ago)
failed, because I couldn't "dd" a CD burned with "burncd". (IE, I
couldn't sucessfully "dd" /dev/acd0, while I could "dd" /dev/cd0).

(Search this for "diff" to find the "verify". ISO images generally
get an extra two blocks of something on the CD "for run-out". See
"-isosize" description of "cdrecord" manpage.)

#!/bin/ksh -o posix

## mkisocd [-blank] -<speed> file_name
#
## This burns and compares a file to the beginning of the write-only CD (CD-R).
## This must be run by superuser.
#
# Note that the CD burning software (burncd) often writes an ISO CD at least a block bigger than the file.
# I'm not sure why. (It's not a hard disk file system block size thing.)

#BURNER=/usr/local/bin/readcd
BURNCD=/usr/sbin/burncd
CDRECORD=/usr/local/bin/cdrecord
BURNER=$BURNCD
BURNER=$CDRECORD

if [ "${1}" == -blank ]; then
if [ ${BURNER} == ${BURNCD} ]; then
BLANK="blank"
else
BLANK="blank=fast"
fi
shift
else
BLANK=
fi
TEMP="${1#-}"
if [ "${TEMP}" != "$1" ]; then
SPEED="${TEMP}"
shift
else
echo 'WARNING: nothing done; speed must be given as "-factor" (eg -16)'
exit 1
fi

FILENAME="$1"

#DEBUG; echo "SPEED = '$SPEED', FILENAME = '$FILENAME'"
#exit

if [ ! -r "${FILENAME}" -o ! -f "${FILENAME}" ]; then
echo "ERROR: The argument, \"${FILENAME}\", is not a readable regular file. Nothing done."
exit 2
fi

## TBD REMOVE
##blocks=$(( $(ls -l "${FILENAME}" | awk '{print $5;}') / ${blockbytes} ))

blockbytes=2048 ## Block size of ISO CDs. Nothing else will work (esp, in dd command).
filebytes=$(stat -f "%z" "${FILENAME}")
fileblocks=$(( ${filebytes} / ${blockbytes} ))
if [ $(( ${fileblocks} * ${blockbytes} )) != ${filebytes} ]; then
echo "ERROR: '${FILENAME}' is not a multiple of the CD blocksize, ${blockbytes}. Nothing done."
exit 3
fi

echo "WARNING: About to burn this file (${filebytes} bytes, ${fileblocks} blocks) to CD."
ls -l "${FILENAME}"
echo -n "Ensure CD in burner and enter \"y\" to continue, else to abort: "

read
if [ "$REPLY" != "y" ]; then
echo "You entered \"$REPLY\", so the command is aborting with nothing done."
exit 4
fi

if [ ${BURNER} == ${BURNCD} ]; then
DEV=/dev/acd0
time burncd -f ${DEV} -s ${SPEED} ${BLANK} data "${FILENAME}" fixate
else
DEV=/dev/cd0 ## cdrecord's default SCSI "dev" is in /usr/local/etc/<something>
time cdrecord -v speed=${SPEED} ${BLANK} "${FILENAME}"
fi

if [ $? != 0 ]; then
echo "ERROR: $BURNER failed. See above error message."
exit 5
fi

beep 2&

sleep 2 ## ??

echo "NOTICE: Comparing \"${FILENAME}\" to the just-written CD. Please wait..."
if dd if=${DEV} count=${fileblocks} bs=${blockbytes} | diff - "${FILENAME}"; then
echo "NOTICE: Comparison OK. The CD seems OK."
else
echo "ERROR: The CD and file differred."
fi

echo done

beep 3&

exit 0

# The End.

Gary W. Swearingen

unread,
Jul 25, 2005, 9:50:00 PM7/25/05
to Glenn Dawson, Brian Henning, freebsd-...@freebsd.org
Glenn Dawson <gl...@antimatter.net> writes:

> did you use bs=2048 when dd'ing from /dev/acd0?

Sure did. And didn't read too many blocks.

Fabian Keil

unread,
Jul 30, 2005, 6:05:42 AM7/30/05
to Gary W. Swearingen, Brian Henning, freebsd-...@freebsd.org
ga...@opusnet.com (Gary W. Swearingen) wrote:

> Brian Henning <brian....@gmail.com> writes:
>
> > I would like to know a process to verify that I my cd burner has
> > burned an ISO file correctly with burncd. I know I can take some
> > precautions like checking the md5sum of the iso during a transfer from
> > the Internet. I also read on the Internet that burncd does puts some
> > extra padding at the end of the cd. I am not sure if that is true or
> > not. Could someone tell me how to verify a cd burn?
>
> Here's a crummy script I just used to burn and verify a CD, but I've
> only tested it with the "cdrecord" setup. Older versions of it worked
> with "burncd" on older OS versions, but I can tell you that the reason
> I'm using "cdrecord" is that my manual efforts to do this with
> "burncd" on 5.4-RELEASE (and maybe 5.4-STABLE a couple weeks ago)
> failed, because I couldn't "dd" a CD burned with "burncd". (IE, I
> couldn't sucessfully "dd" /dev/acd0, while I could "dd" /dev/cd0).
>
> (Search this for "diff" to find the "verify". ISO images generally
> get an extra two blocks of something on the CD "for run-out". See
> "-isosize" description of "cdrecord" manpage.)

Not generally, only if you burn in TAO mode.

BTW you can use readcd -c2scan to check the burning quality at
a deeper level and there even is a patch out there to make reading
c1 error pointers possible. Haven't tested it though.

Fabian
--
http://www.fabiankeil.de/

0 new messages