You are not logged in.

#1 2009-03-04 09:57:35

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

md5sum alternative[SOLVED]

Hi,

Is there an alternative to md5sum for caclulating sums for a burned CD/DVD? Something in the line of

$ md5sum /dev/sr0

but another way? Without md5sum utility at all?

Last edited by Llama (2009-03-05 08:38:47)

Offline

#2 2009-03-04 10:08:34

muczyjoe
Member
From: Szeged (Hungary)
Registered: 2007-05-16
Posts: 45
Website

Re: md5sum alternative[SOLVED]

There are many other "summing" utilities:
$ pacman -Ql coreutils | grep sum

Last edited by muczyjoe (2009-03-04 10:08:49)

Offline

#3 2009-03-04 10:55:43

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: md5sum alternative[SOLVED]

Llama wrote:

Hi,

Is there an alternative to md5sum for caclulating sums for a burned CD/DVD? Something in the line of

$ md5sum /dev/sr0

but another way? Without md5sum utility at all?

Why?

And checksums utility are not only used for burned cd/dvd, they can be used with any files.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#4 2009-03-04 10:59:28

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: md5sum alternative[SOLVED]

Sorry, I meant a utility, doing the job of md5sum on md5 sums. Is it any of these:

coreutils /usr/bin/cksum
#coreutils /usr/bin/md5sum
coreutils /usr/bin/sha1sum
coreutils /usr/bin/sha224sum
coreutils /usr/bin/sha256sum
coreutils /usr/bin/sha384sum
coreutils /usr/bin/sha512sum
coreutils /usr/bin/sum

Offline

#5 2009-03-04 11:04:35

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: md5sum alternative[SOLVED]

shining wrote:

Why?

Because I'm having a lot of trouble with md5sum, checking burned CD/DVDs, like this:

$ md5sum /dev/sr0

the disk unmounted.

I run the md5sum utility this way on two different boxes, on apparently healthy CDs and DVDs, with unpredictable results. It's either a correct sum, or a wrong sum, or just Input/Output error. Sometimes md5sum takes some time calculating the sum; the result is usually either a correct sum, or an I/O error. Sometimes it gives me a wrong answer right away after giving the initial spin to the disk, without even making a decent show of calculation.

It looks like there's some context to the operation that I'm not aware of.

Offline

#6 2009-03-04 11:24:26

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: md5sum alternative[SOLVED]

Ok so that's much clearer now. I felt like you were hiding something, please don't! Give as much information as you can in your first post and tell us the real problem you have.

Did you try google?
http://www.google.com/search?hl=en&q=md … tnG=Search
It seems like you are not the only one having this problem.
Do you get the same Input/Output error with
cat /dev/sr0 > /dev/null
dd if=/dev/sr0 of=/dev/null
?

Everything works fine on my box, no input/output error. It might only happen with specific drives.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#7 2009-03-04 11:54:49

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: md5sum alternative[SOLVED]

[me@my ~]$ cat /dev/sr0 > /dev/null
cat: /dev/sr0: Input/output error
[me@my ~]$ dd if=/dev/sr0 of=/dev/null
307040+0 records in
307040+0 records out
157204480 bytes (157 MB) copied, 78.3067 s, 2.0 MB/s
[me@my ~]$

For a given CD, at this moment the output is exactly the same for two boxes, one of them a laptop.

I did try google, but without much success. I still can't make much of all this.

Last edited by Llama (2009-03-04 12:00:59)

Offline

#8 2009-03-04 12:14:39

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: md5sum alternative[SOLVED]

If you get I/O errors while reading from your CD (no matter if it's with md5sum, dd, cat or anything else), it's very clearly a hardware issue with your drive or disc.


1000

Offline

#9 2009-03-04 14:04:59

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: md5sum alternative[SOLVED]

but the 'dd'-command went ok!
I haven't actually tested this - but I have a sneaking feeling that 'cat' might well produce an error if used on a plain 'device' (ie /dev/whatever)

To use something other than md5sum won't tell you anything at all, will it?
If we are talking about checking out a downloaded cd/dvd you want to check against the provided md5sum (or possibly the sha1sum).

Offline

#10 2009-03-05 07:09:01

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: md5sum alternative[SOLVED]

The solution: http://forums.debian.net/viewtopic.php?p=213219#213219

#!/bin/bash
#shell script to verify a burned iso

ISOFILE=$1
echo "Isofile: " $ISOFILE
DVDDRIVE=/dev/sr0
BYTES=2048

#Get the number of extends
NROFEXTENDS=$(($(ls -l $ISOFILE | awk '{ print $5 }') / $BYTES ))
echo "Nr of extends: " $NROFEXTENDS

#Get MD5 sum of DVD
dd if=$DVDDRIVE bs=$BYTES count=$NROFEXTENDS | md5sum

#Get MD5 sum of iso file
md5sum $ISOFILE

Last edited by Llama (2009-04-19 22:15:24)

Offline

#11 2009-03-05 15:57:22

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: md5sum alternative[SOLVED]

I beg to disagree - you _should_ use cdrecord/wodim to burn a cd, _not_ dd though the latter is OK to _read_ from a cd.
If I remember correctly - the blocksize (as used by cdrecord/wodim) is somewhere around 2260 bytes. It most certainly is _not_ 2k.

In short, then:
cdrecord -v driveropts=burnfree dev=/dev/sr0 -dao -eject -data $ISOFILE
dd if=/dev/sr0 bs=4M of=$ISOFILE  # you will (almost always) get a partial last block which doesn't matter

Offline

#12 2009-03-05 16:35:35

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: md5sum alternative[SOLVED]

perbh wrote:

I beg to disagree - you _should_ use cdrecord/wodim to burn a cd

I've used either wodim or k3b for burning. There's not one ruined CD/DVD in evidence: the checking turned out to be a problem.

Offline

#13 2009-03-05 16:51:02

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: md5sum alternative[SOLVED]

Oh, that is interesting smile
Seems like it might be safer to use isoinfo to find out the logical block size. Or is it always always always 2048? I have no idea smile
http://www.brunolinux.com/01-First_Thin … d_CDs.html
http://www.brunolinux.com/01-First_Thin … cript.html

Interesting info anyway, thanks.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#14 2009-03-05 17:09:42

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: md5sum alternative[SOLVED]

sorry - didn't read the link properly :-(
I would still maintain that you can use 'dd' with _any_ blocksize and pipe the output through md5sum

ie:
dd if=/dev/sr0 bs=4M | md5sum


<edit>
looking at the 'bruno' links above - it would seem that my memory fails me (yet again)
just regard my two posts as 'utter rubbish' please ...
</edit>

Last edited by perbh (2009-03-05 17:13:49)

Offline

#15 2009-06-23 10:42:59

kfgz
Member
From: Supraśl, Poland
Registered: 2009-03-02
Posts: 114

Re: md5sum alternative[SOLVED]

Here is another quick & dirty solution (without using isoinfo).

#!/bin/sh
device=$1
pmount $device /media/cd
cdsize=`df /media/cd | tail -n 1 | awk '{print $2}'`
pumount --yes-I-really-want-lazy-unmount /media/cd
dd if=$device bs=1K count=$cdsize | md5sum | cut -f 1 -d " "

Last edited by kfgz (2009-10-13 20:12:33)

Offline

Board footer

Powered by FluxBB