PDA

View Full Version : Verify md5sum



borgward
12th February 2010, 12:09 AM
I copied file1061_20100202210000.mpg.ah from DVD rw to file:///home/xyz/Lostsp/1061_20100202210000.mpg.ah

I ran: md5sum -c /home/xyz/Lostsp/1061_20100202210000.mpg.ah

Results:

[xyz@localhost ~]$ md5sum -c /home/xyz/Lostsp/1061_20100202210000.mpg.ah
md5sum: : No such file or directory
: FAILED open or read
md5sum: X: No such file or directory
X: FAILED open or read
md5sum: X: No such file or directory
X: FAILED open or read
md5sum: _HHU3$,>▒v7)
: No such file or directory
_HHU3$,>▒v7)
: FAILED open or read
md5sum: a0(p@; 1: No such file or directory
a0(p@; 1: FAILED open or read
md5sum: : No such file or directory
: FAILED open or read
md5sum: 4(oS%
+@)+'B: No such file or directory
4(oS%
+@)+'B: FAILED open or read
md5sum: ,o7G: No such file or directory
,o7G: FAILED open or read
md5sum: wZ5SAh+ɺP_R▒dB`[l(1E@/: No such file or directory
wZ5SAh+ɺP_R▒dB`[l(1E@/: FAILED open or read
md5sum: )(h'p &~: No such file or directory
)(h'p &~: FAILED open or read
md5sum: $ Vo($|)P
n;MU35B: No such file or directory
$ Vo($|)P
n;MU35B: FAILED open or read
md5sum: -VU@Ps/.{9gLaTƪU^3UT mL&qu82jihIR]7SmC#^[[?1;2c: No such file or directory
`0Ka~<-VU@Ps/.{9gLaTƪU^3UT mL&qu82jihIR]7SmC#: FAILED open or read
l?1;2cmd5sum: {(
~"[▒6
,-Qzkc@v'G: No such file or directory
l
~"[▒6
,-Qzkc@v'G: FAILED open or read
md5sum: H)
Uh(Ljp +▒7VO*M5 AG: No such file or directory
H)
Uh(Ljp +▒7VO*M5 AG: FAILED open or read
md5sum: Cz,"X!2}5CEwD?jCO#tQ, E▒tQghi,FwjS"
_DD"G: No such file or directory
Cz,"X!2}5CEwD?jCO#tQ, E▒tQghi,FwjS"
_DD"G: FAILED open or read
md5sum: MZMAtGBxUU▒@]`5D<I3*IF<qt*]$f߿hLT;8t2"u 33.& ߪU2-Bb T: No such file or directory
MZMAtGBxUU▒@]`5D<I3*IF<qt*]$f߿hLT;8t2"u 33.& ߪU2-Bb T: FAILED open or read
md5sum: WARNING: 16 of 16 listed files could not be read

-----

A file on the dvd lists the md5sum as:

2aa6cde4d656b1f5266e38d1141fdc0f 1061_20100202210000.mpg.ah

Did I do something wrong or is the file just no good. Maybe the DVD player is no good? How to check?

Running CentOS 5.0

PabloTwo
12th February 2010, 01:02 AM
Try it without the "-c" option. If I'm understanding the man page for md5sum correctly, the -c option is telling md5sum to expect to find an md5 checksum embedded in the file itself.

borgward
12th February 2010, 02:13 AM
OK,

[abc@localhost ~]$ md5sum /home/abc/Lostsp/1061_20100202210000.mpg.ah
2aa6cde4d656b1f5266e38d1141fdc0f /home/abc/Lostsp/1061_20100202210000.mpg.ah

I guess that it checks out. 2aa6cde4d656b1f5266e38d1141fdc0f matches the md5sum listed in the md5sum file in the DVD : 2aa6cde4d656b1f5266e38d1141fdc0f 1061_20100202210000.mpg.ah

so what is the -c option used for? I can not figure why someone told me to use the -c option

stoat
12th February 2010, 02:31 AM
so what is the -c option used for? I can not figure why someone told me to use the -c option Hello borgward,

If the hash being used for comparison is in a text file and in the proper format, then you can use the -c option and specify that text file in the md5sum command instead of the file being checked. What that does is make md5sum generate the hash on the file being checked AND do the comparison for you. The result is returned as OK, FAILED, or No such file or directory.

For example, Fedora ISO files are accompanied by a text file which contains the hashes. Nowadays, they are SHA-256 hashes, but the concept being illustrated is the same for md5sum. If you were to download say, Fedora-12-i386-DVD.iso and Fedora-12-i386-CHECKSUM to the same directory, then the -c option would be used like this...
sha256sum -c Fedora-12-i386-CHECKSUM

borgward
12th February 2010, 02:42 AM
so in my case,

[abc@localhost ~]$ md5sum -c /home/abc/Lostsp/1061_20100202210000.mpg.ah - checksum

?

stoat
12th February 2010, 03:13 AM
so in my case,

[abc@localhost ~]$ md5sum -c /home/abc/Lostsp/1061_20100202210000.mpg.ah - checksumI have no way of knowing that from what you've posted so far. To use the -c option, you need a plain text file in the proper and expected format that contains the hash (or hashes) of the file (or files) being checked. That file should be in the same directory as the file being checked. Then md5sum will read the hash (or hashes) listed in that text file and use them to compare against the hash (or hashes) that it generates from the file (or files) being checked. So is there a file named this in that Lostsp directory?...
/home/abc/Lostsp/1061_20100202210000.mpg.ah - checksumAnd is it a plain text file that contains the MD5 hash of the file being checked, and is it in the proper format? If it is, then the answer to your question is yes. Here is an example of the format from that same file named Fedora-12-i386-CHECKSUM that I used as an example above...
f0ad929cd259957e160ea442eb80986b5f01daaffdbcc7e5a1 840a666c4447c7 *Fedora-12-i386-DVD.iso
2f548ce50c459a0270e85a7d63b2383c55239bf6aead9314a0 f887f3623ddace *Fedora-12-i386-disc1.iso
ce77d16d1b3362859aaa856f1f29c7197db69264d8ce6b9f81 11dcee4d5e9ef7 *Fedora-12-i386-disc2.iso
8c39cb9e3c1583948dcad21f9fdbe48a3ff6a8d1b536462188 d47747c2640b36 *Fedora-12-i386-disc3.iso
07f03f67d23331e8c7a37ad19e9a99062a4584a3e028beb40c 49923bb5c70c6b *Fedora-12-i386-disc4.iso
dff8c478fb73452a8799016deeecccde3097d40a0b756d681b fe6be2e56bb9eb *Fedora-12-i386-disc5.iso
128112527bdd4036ec82d678b5d5362aa7a11ac15a73647afd 743d7a325f7df9 *Fedora-12-i386-netinst.isoNone of this is really important. It's intended to make checking hashes easier, not harder. You can always just generate the hash with md5sum in the ordinary way and manually compare the hashes. Where this really comes in handy is when you are checking several files at once, say, all of those Fedora CD ISO files.

borgward
12th February 2010, 06:06 AM
There a text file named CHECKSUMthis in the Lostsp directory.

It is a plain text file that contains the MD5 hash of the file being checked.

As for the "proper format", I do not know. Here is an exaple from that text file:

0307961624626b1d0101d00c4653d924 1061_20100202195900.mpg.ae
7e6c1e70066e76882b1657d1e28dc3f2 1061_20100202195900.mpg.af
91849d1e14883aee670b662990987d4c 1061_20100202210000.mpg.aa
2b45963b416fcccbcf9ef808eff37f06 1061_20100202210000.mpg.ab

stoat
12th February 2010, 06:19 AM
It looks okay to me. I'm sure you've already confirmed the hash by now, but try this just to settle (hopefully) this issue about the -c thing...
md5sum -c CHECKSUMIf it works right, it should give results as "OK", "FAILED", or "No such file or directory" for each one of those hashes listed in the file. If you're only checking one file, only it will say "OK" or "FAILED" in the result. The others, since they aren't present, will give the "No such file or directory" result.

borgward
12th February 2010, 07:06 AM
Thanks.

I just did that after figuring that I had to change to the Lostsp directory:

[abc@localhost Lostsp]$ md5sum -c MD5SUM
md5sum: 1061_20100202195900.mpg: No such file or directory
1061_20100202195900.mpg: FAILED open or read
1061_20100202195900.mpg.png: FAILED
md5sum: 1061_20100202210000.mpg: No such file or directory
1061_20100202210000.mpg: FAILED open or read
md5sum: 1061_20100202210000.mpg.png: No such file or directory
1061_20100202210000.mpg.png: FAILED open or read
1061_20100202195900.mpg.aa: OK
1061_20100202195900.mpg.ab: OK
1061_20100202195900.mpg.ac: OK
1061_20100202195900.mpg.ad: FAILED
1061_20100202195900.mpg.ae: OK
1061_20100202195900.mpg.af: OK
1061_20100202210000.mpg.aa: OK
1061_20100202210000.mpg.ab: OK
1061_20100202210000.mpg.ac: OK
1061_20100202210000.mpg.ad: OK
1061_20100202210000.mpg.ae: OK
1061_20100202210000.mpg.af: FAILED
1061_20100202210000.mpg.ag: OK
1061_20100202210000.mpg.ah: OK
1061_20100202210000.mpg.ai: OK
1061_20100202210000.mpg.aj: FAILED
1061_20100202210000.mpg.ak: OK
1061_20100202210000.mpg.al: OK
md5sum: WARNING: 3 of 22 listed files could not be read
md5sum: WARNING: 4 of 19 computed checksums did NOT match
[abc@localhost Lostsp]$

stoat
12th February 2010, 03:37 PM
Good. Now you know how to use the -c option. It's handy when there are many files to verify. The result that you posted indicates (to me, anyway) that some of the files listed in CHECKSUM appear not to have been downloaded, some perhaps can be ignored, and some need to be downloaded again.