TIP: Click on subject to list as thread! ANSI
echo: linuxhelp
to: All
from: John Beckett
date: 2007-01-02 09:41:28
subject: Verify DVD with sha1sum

From: John Beckett 

Randall
This is a repost because my message might have been lost in the fido flood.

> Once I have burned a DVD is there a way to:
> 1) Calc sha1sum for what is on the DVD?
> 2) Compare a DVD with a .iso file to see if the DVD got exactly what
> the  iso file has?

I'm starting to get back into Linux ... it's been ages, and I never was
more than a dabbler, so take my comments with caution.

Let's suppose you have the DVD mounted under /mnt/dvd ('mount' would show
something like '/dev/hdc on /mnt/dvd').

To checksum all files on the DVD:
find /mnt/dvd -type f -print0 | xargs -0 sha1sum > sha.txt

Later, to check if files are unchanged: sha1sum -c sha.txt > result.txt

To examine an ISO image, you can mount the image using the loopback device.

mkdir /mnt/iso
mount -t iso9660 -o ro,noexec,loop example.iso /mnt/iso

Now browse /mnt/iso to see the files in the ISO. You could checksum all its files:

find /mnt/iso -type f -print0 | xargs -0 sha1sum > sha2.txt

Then compare sha1.txt with sha2.txt. You would need to edit sha2.txt to
replace every '/mnt/iso' with
'/mnt/dvd/ first.

I am having trouble working out why the above 'find ... sha1sum ...'
command works correctly when some file paths have embedded spaces. A quick
experiment suggests that it does work, but my theory tells me it shouldn't.

BTW the xargs business constructs one command containing ALL the file paths
in a single gigantic line. I don't know when it would break. An alternative
would invoke sha1sum multiple times:

find /mnt/dvd -type f -exect sha1sum {}  \; > sha.txt

John

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.