Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By the_gripmaster at 2011-11-14 19:39
This tutorial is about how to verify the integrity of a DV/DVD burned from a ISO. Some CD/DVD burning applications add extra data when burning to the CD/DVD. So, a direct MD5 of the media may give you a misleading result. The trick is to calculate the MD5 of the CD/DVD disregarding the extra data the burning application has written.
#!/usr/bin/env sh
# Purpose: check integrity of a burned DVD with the ISO
if [ $# -ne 1 ]; then
echo "Usage: $0 /path/to/isofile.iso"
exit 1
fi
# the hash application to use, can be other like sha1sum, sha256sum, sha512sum, cksum
HASHAPP='md5sum'
# change if your device is different
DVDDRIVE='/dev/dvd'
# the ISO file
ISOFILE=$1
# check to see if file exists
if ! [ -e ${ISOFILE} ]; then
echo "${ISOFILE} does not exist"
exit 1
fi
hash_of_iso=$(${HASHAPP} ${ISOFILE} | cut -d' ' -f1)
echo "info: ${HASHAPP} of ${ISOFILE} - ${hash_of_iso}"
bytes_of_iso=$(wc --bytes ${ISOFILE})
hash_of_dvd=$(dd if=${DVDDRIVE} | head --bytes ${bytes_of_iso} | ${HASHAPP} | cut -d' ' -f1)
echo "info: ${HASHAPP} of ${DVDDRIVE} - ${hash_of_dvd}"
if [ ${hash_of_iso} == ${hash_of_dvd} ]; then
echo "OK: ${HASHAPP} of ISO(${bytes_of_iso}) matches ${HASHAPP} of DVD(${hash_of_dvd})"
exit 0
else
echo "FAIL: ${HASHAPP} of ISO(${bytes_of_iso}) does not match ${HASHAPP} of DVD(${hash_of_dvd})"
exit 1
fi
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.