LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-26-2007, 03:52 AM   #1
mikepj
LQ Newbie
 
Registered: Nov 2004
Distribution: Kubuntu 6.10
Posts: 12

Rep: Reputation: 0
Question Am i using md5sum correctly?


Hello fellow linux people. I am having some issues verifying burnt dvd iso's with k3b at present. Every verification has been a failure. I have read forum postings and found that others have also had issues. Anyway my last burn at 4x failed to verify, but I used md5sum manually like this which looks ok:

myname@ubuntu-desktop:~/Extraction$ cat mydisc.iso | md5sum
7a82aae5d938b33d5908619e7ea0c7c3 -
myname@ubuntu-desktop:~/Extraction$ nice -20 dd if=/dev/hda bs=2048 count=892781 | md5sum
7a82aae5d938b33d5908619e7ea0c7c3 -
892781+0 records in
892781+0 records out
1828415488 bytes (1.8 GB) copied, 313.313 seconds, 5.8 MB/s

Being a slightly paranoid sort of person I'd be grateful if someone who burns lots of discs in linux could tell me whether md5sum is right and that its verified or k3b is right and its a bad disk.

thanks guys

Possible useful info:
Kubuntu6.10
-----------------------
K3b Version: 1.0rc4

KDE Version: 3.5.5
QT Version: 3.3.6
Kernel: 2.6.17-10-generic
Devices
-----------------------
SONY DVD RW DRU-710A BYX5 (/dev/hda, ) [CD-R, CD-RW, CD-ROM, DVD-ROM, DVD-R, DVD-RW, DVD+R, DVD+RW, DVD+R DL] [DVD-ROM, DVD-R Sequential, DVD-RW Restricted Overwrite, DVD-RW Sequential, DVD+RW, DVD+R, CD-ROM, CD-R, CD-RW] [SAO, TAO, RAW, SAO/R96P, SAO/R96R, RAW/R16, RAW/R96P, RAW/R96R, Restricted Overwrite]

Used versions
-----------------------
growisofs: 7.0.1

Last edited by mikepj; 01-26-2007 at 04:19 AM.
 
Old 01-26-2007, 05:31 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Did you burn the disk from an image you downloaded, which included an md5 checksum file (like a linux dvd download).

You can verify the image with "md5sum -f md5sumfile"

If what you are trying to do is verify if a burnt disk matches your original image, then the command you used to verify indicates that the disk matches the file provided that your parameters included the entire image.

Does "stat -f /dev/hda" give the same number of blocks as you used in the dd | md5sum command?
I wonder if there are few null bytes after the image being read by k3b and that is the cause of the failure.

You might try mounting the image and looking at the block size and number of blocks using stat.
Code:
 ls -l /home/openSUSE-10.2-GM-DVD-x86_64.iso
-rw------- 1 root root 3932309504 2007-01-14 20:11 /home/openSUSE-10.2-GM-DVD-x8               6_64.iso
jschiwal@hpamd64:~> stat -f /media/SU1020.001/
  File: "/media/SU1020.001/"
    ID: 0        Namelen: 255     Type: isofs
Block size: 2048       Fundamental block size: 2048
Blocks: Total: 1920073    Free: 0          Available: 0
Inodes: Total: 0          Free: 0
jschiwal@hpamd64:~> echo $((2048*1920073))
3932309504
jschiwal@hpamd64:~> ls -l /home/openSUSE-10.2-GM-DVD-x86_64.iso
-rw------- 1 root root 3932309504 2007-01-14 20:11 /home/openSUSE-10.2-GM-DVD-x86_64.iso
Code:
md5sum /home/openSUSE-10.2-GM-DVD-x86_64.iso && dd bs=2048 count=1920073 /dev/sr0 | md5sum -
If the two checksums match then you can be assured that the dvd was burnt correctly.

Even if you have two different checksums, you might try getting the checksums of the files contained in the image and in the dvd and compare them. Maybe the difference isn't in a place that is important.

Last edited by jschiwal; 01-26-2007 at 05:48 AM.
 
Old 01-26-2007, 07:14 AM   #3
mikepj
LQ Newbie
 
Registered: Nov 2004
Distribution: Kubuntu 6.10
Posts: 12

Original Poster
Rep: Reputation: 0
Thank you for your reply. The iso i'm trying to burn is actually a home brew iso I created using mkisofs. I did as you suggested and here is the outcome:

myname@ubuntu-desktop:~$ stat -f /dev/hda
File: "/dev/hda"
ID: 0 Namelen: 255 Type: tmpfs
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 2560 Free: 2522 Available: 2522
Inodes: Total: 64453 Free: 63623

myname@ubuntu-desktop:~/Extraction$ stat -f mydisc.iso
File: "mydisc.iso"
ID: 0 Namelen: 255 Type: ext2/ext3
Block size: 4096 Fundamental block size: 4096
Blocks: Total: 24970173 Free: 18644894 Available: 17376462
Inodes: Total: 12697600 Free: 12677609

erm.. shouldn't the block size be 2048 have I misused mkisofs?

If the checksums are different how do I know whether or not the difference is in an important place or not?

Last edited by mikepj; 01-26-2007 at 07:45 AM.
 
Old 01-26-2007, 09:58 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
That I don't know. I used an image of the openSuSE 10.2 which is only 3GB. Maybe a double layer dvd uses a larger blocksize or even one that is full does as well.
I'll pop in a DL disk and see what it says.
 
Old 01-26-2007, 11:51 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I popped in an old SuSE 8.2 Professional. It turned out that it is 4.7GB, but the block size is 4096.

I might be wrong about the output of stat however. Some commands like ls will give a block size, but it simply is what the command regards as the block size (1024). The block size of the image file will be the block size of the file system it is on of course. I just didn't want an arbitrary block size causing a difference between blocksize*count and the number of bytes in the image file or disk.

You might play around with something like this:
Code:
dd bs=4096 count=$COUNT skip=$OFFSET if=mydisk.iso | md5sum - && dd bs=4096 count=$COUNT skip=$OFFSET if=/dev/hda | md5sum -
Also, for the iso file, look at "stat mydisk.iso" instead of "stat -f mydisk.iso"
example:
Code:
 stat /home/SU8000.001.iso
  File: `/home/SU8000.001.iso'
  Size: 4676616192      Blocks: 9142936    IO Block: 4096   regular file
For this example, try bs=9142935 for both the dvd image and /dev/hda. I still have a feeling that you are dealing with a filesystem image that has null bytes filling out the end of the last block. If the md5sums are the same, use count=1 with offset=9142935 to compare the last block. Or even subtract 4096 from the byte size of the disk and use that as the skip value, with a blocksize of 1. I don't know if when the image is created to the disk, the filesystems's blocksize causes the last block to be padded or contain random characters. KDE3 might be only counting upto the real end of the iso9660 filesystem and ignores the rest.

---

You could also calculate the md5sums of the contents of every file on the dvd. Do the same with the files in the mounted image. Then see if any of the files differ. You could also use the "cmp" command to compare the files:

Code:
jschiwal@hpamd64:~> find /media/SU8000.001/ -type f -exec md5sum '{}' \; | cat -n >dvdfiles

jschiwal@hpamd64:~> find /home/jschiwal/su8/ -type f -exec md5sum '{}' \; | cat -n >imagefiles

head -n 10 imagefiles
     1  28d39c3bb39aa34daf52f771d8e92649  /home/jschiwal/su8/ARCHIVES.gz
     2  d5ac631234ba78df4169c9abc84bceef  /home/jschiwal/su8/autorun.inf
     3  a13f22ed6a6f393f5e6c1ad3be1ea820  /home/jschiwal/su8/ChangeLog
     4  94d55d512a9ba36caa9b7df079bae19f  /home/jschiwal/su8/COPYING
     5  68c62cc6dc1caa32402599c0a5f83f9f  /home/jschiwal/su8/COPYING.tex
     6  5775de4f4caa286724d9ae3c10f3e8f3  /home/jschiwal/su8/COPYRIGHT
     7  70777fc08c006a6dda41da2b2043ed76  /home/jschiwal/su8/COPYRIGHT.yast
     8  273a31a209b9aca32e2a76a96cac3812  /home/jschiwal/su8/disks/bootdisk
     9  f5e08c2c1143da4dbfd1d12339d8b3b4  /home/jschiwal/su8/disks/i386
    10  5647f396f53b9a1a7684db57876e9acc  /home/jschiwal/su8/disks/LIESMICH
jschiwal@hpamd64:~> head -n 10 dvdfiles
     1  28d39c3bb39aa34daf52f771d8e92649  /media/SU8000.001/ARCHIVES.gz
     2  d5ac631234ba78df4169c9abc84bceef  /media/SU8000.001/autorun.inf
     3  a13f22ed6a6f393f5e6c1ad3be1ea820  /media/SU8000.001/ChangeLog
     4  94d55d512a9ba36caa9b7df079bae19f  /media/SU8000.001/COPYING
     5  68c62cc6dc1caa32402599c0a5f83f9f  /media/SU8000.001/COPYING.tex
     6  5775de4f4caa286724d9ae3c10f3e8f3  /media/SU8000.001/COPYRIGHT
     7  70777fc08c006a6dda41da2b2043ed76  /media/SU8000.001/COPYRIGHT.yast
     8  273a31a209b9aca32e2a76a96cac3812  /media/SU8000.001/disks/bootdisk
     9  f5e08c2c1143da4dbfd1d12339d8b3b4  /media/SU8000.001/disks/i386
    10  5647f396f53b9a1a7684db57876e9acc  /media/SU8000.001/disks/LIESMICH
I did it this way so that it would be possible to strip of the last field and use diff to find any differences. The number will allow you to look up what the file is.

Last edited by jschiwal; 01-26-2007 at 12:25 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cp changes md5sum kel_en Mandriva 0 07-05-2005 08:44 AM
md5sum - then what? wmcase Linux - Software 2 10-05-2004 10:55 AM
Help with MD5SUM Smokeball Linux - Newbie 3 08-30-2003 10:45 PM
Md5sum ? mikeshn Linux - General 6 07-03-2003 11:09 AM
Md5sum yenonn Linux - General 1 04-10-2003 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration