From owner-freebsd-questions@FreeBSD.ORG Mon Jul 25 17:37:30 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BD5CC16A41F for ; Mon, 25 Jul 2005 17:37:30 +0000 (GMT) (envelope-from garys@opusnet.com) Received: from opusnet.com (mail.opusnet.com [209.210.200.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 79CF143D49 for ; Mon, 25 Jul 2005 17:37:29 +0000 (GMT) (envelope-from garys@opusnet.com) Received: from localhost.localhost [70.98.247.55] by opusnet.com with ESMTP (SMTPD32-8.05) id A35A673300B6; Mon, 25 Jul 2005 10:37:30 -0700 Received: from localhost.localhost (localhost.localhost [127.0.0.1]) by localhost.localhost (8.13.3/8.13.3) with ESMTP id j6PHc6W5001732; Mon, 25 Jul 2005 10:38:06 -0700 (PDT) (envelope-from garys@opusnet.com) Received: (from jojo@localhost) by localhost.localhost (8.13.3/8.13.3/Submit) id j6PHc19g001731; Mon, 25 Jul 2005 10:38:01 -0700 (PDT) (envelope-from garys@opusnet.com) To: Brian Henning References: <1f75ab0e05072510117c119a1d@mail.gmail.com> From: garys@opusnet.com (Gary W. Swearingen) Date: Mon, 25 Jul 2005 10:38:01 -0700 In-Reply-To: <1f75ab0e05072510117c119a1d@mail.gmail.com> (Brian Henning's message of "Mon, 25 Jul 2005 12:11:35 -0500") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-questions@freebsd.org Subject: Re: burncd - verify burn X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2005 17:37:30 -0000 Brian Henning 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.) #!/bin/ksh -o posix ## mkisocd [-blank] - 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/ 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.