Skip to Main Content
Linux System Administration
book

Linux System Administration

by Tom Adelstein, Bill Lubanovic
March 2007
Intermediate to advanced content levelIntermediate to advanced
304 pages
11h 12m
English
O'Reilly Media, Inc.
Content preview from Linux System Administration
250
|
Chapter 11: Backing Up Data
Verifying the Recording
After you’ve recorded a CD or DVD, it’s a good idea to verify that the recording
reads back correctly. The media may be defective, or the computer may have been
bumped during the recording, causing the laser to be moved out of the groove.
The correct way to verify a recording is to either compare the sectors recorded with
the sectors on the hard disk or generate checksums of those sectors and compare
them. Both methods must be used only with the actual data sectors, not the padding
sectors. The following bash shell script makes this verification easy when the origi-
nal ISO image file is available:
#!/bin/bash
if [[ $# -lt 1 ]] ; then
echo "usage: isomd5 <file_or_device> ..." 1>&2
exit 1
fi
for name in "$@" ; do
isoinfo -di "${name}" 1>/dev/null || exit 1
done
for name in "$@" ; do
count=( $( isoinfo -di "${name}" \
| egrep "^Volume size is: " ) )
count="${count[3]}"
bsize=( $( isoinfo -di "${name}" \
| egrep "^Logical block size is: " ) )
bsize="${bsize[4]}"
md5=$( dd \
if="${name}" \
ibs="${bsize}" \
obs=4096 count="${size}" \
2>/tmp/isomd5.$$.err \
| md5sum )
if [[ $? != 0 ]] ; then
cat /tmp/isomd5.$$.err
rm -f /tmp/isomd5.$$.err
exit 1
fi
rm -f /tmp/isomd5.$$.err
echo "${md5:0:32}" "" "${name}"
done
This script works by obtaining the number of sectors used by the ISO filesystem in
the image file. It limits the number of sectors read
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux System Administration

Mastering Linux System Administration

Christine Bresnahan, Richard Blum
Mastering Linux Administration

Mastering Linux Administration

Alexandru Calcatinge, Julian Balog

Publisher Resources

ISBN: 9780596009526Supplemental ContentCatalog PageErrata