Notices |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
First, calculate the MD5 sum of the ISO
Code:
[user@host Fedora16]$ md5sum Fedora-16-x86_64-DVD.iso
bb38ea1fe4b2fc69e7a6e15cf1c69c91 Fedora-16-x86_64-DVD.iso
Next, count the number of bytes of the ISO (note down the size)
Code:
[user@host Fedora16]# wc --bytes Fedora-16-x86_64-DVD.iso
3757047808 Fedora-16-x86_64-DVD.iso
Now, put the CD/DVD in the drive and calculate the MD5 disregarding the extra data
Code:
[user@host Fedora16]$ dd if=/dev/dvd | head --bytes 3757047808 | md5sum
bb38ea1fe4b2fc69e7a6e15cf1c69c91 -
Here's a script you can use:
Code:
#!/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
|
|
|
All times are GMT -5. The time now is 01:40 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|