You are not logged in.
Hi,
I wonder how I can check the integrity of a burnt Arch install CD using the command line. I've googled about this, and several online tutorials indicate the following method:
$ md5sum /dev/<cdrom_device>
In my case, I gave md5sum /dev/hdc a spin (on a CentOS machine), which gave me an "I/O error". But I know the CD reader is physically intact, and the CD is also correctly burnt (because I just used it successfully on another machine).
I tried the MD5 check with the USB stick using dd if=/dev/sdx count=number_of_records status=noxfer | md5sum, and it works. Now I'm basically looking for something similar for the CD.
Last edited by kikinovak (2011-01-10 10:55:02)
Dyslexics have more fnu.
Offline
You may have more luck if you run that command on iso file
Mr Green
Offline
Thanks, I know how to check the integrity of an ISO file. But I experimented around a bit, and I finally found the answer.
1) Check ISO file size.
2) x = iso_file_size / 2048
3) Check :
$ dd if=/dev/cdrom bs=2048 count=x | md5sum
Works like a charm.
Dyslexics have more fnu.
Offline
/dev/hdc is a hard drive, not an optical station. /dev/cdrom or /dev/sr0 (to which /dev/cdrom is usually a symlink) should work.
$ md5sum /dev/sr0
then compare output to the md5 that's provided by the Arch ISO mirror.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Shouldn't the result be different? Doesn't the iso file have a header or metadata or something?
Offline
/dev/hdc is a hard drive, not an optical station.
The machine I'm testing this on is a CentOS 5.5 install with a 2.6.18 kernel, which still addresses IDE drives as /dev/hdX. Thus, /dev/hdc is the first drive on my second IDE bus, which happens to be a DVD reader.
Dyslexics have more fnu.
Offline
OK, here's a little synopsis. Maybe you feel like adding parts of it to the wiki.
Here's my downloaded ISO file:
$ ls -l archlinux-2010.05-core-dual.iso
-rw-r--r-- 1 kikinovak kikinovak 691011584 déc 8 16:12 archlinux-2010.05-core-dual.iso
I'm burning it to a CD :
# cdrecord dev=/dev/cdrom -v -eject -speed=4 archlinux-2010.05-core-dual.iso
I want to know how many 2048 byte blocks are contained in my ISO file. So I divide 691011584 by 2048, which gives me a total of 337408 blocks. Now I can simply run MD5 on my burnt CD like this:
$ dd if=/dev/cdrom bs=2048 count=337408 | md5sum
One last note: of course, I could equally invoke the command like this, without going through the arithmetic hassle:
$ dd if=/dev/cdrom bs=1 count=691011584 | md5sum
You can give it a spin and see how fast your optical drive reads information in 1-byte blocks. (Hint: not very fast)
Dyslexics have more fnu.
Offline
Not sure the whole point of the thread, you really should check md5sum before burning to cd [more so with CD-R]
This information is a simple search away ....
Always very wary of using dd can cause problems if used incorrectly
MrG
Mr Green
Offline
Not sure the whole point of the thread
1) Performing an MD5 check on a downloaded ISO checks the sanity of the file on your hard disk.
2) Performing an MD5 check on the burnt CD checks the sanity of the installation media.
3) (1) and (2) are two different things.
Dyslexics have more fnu.
Offline
https://wiki.archlinux.org/index.php/Of … tion_Media
If you downloaded the image, verified checksums & they were OK, but something went wrong when burning, use lower speed.
Offline
Mr Green wrote:Not sure the whole point of the thread
1) Performing an MD5 check on a downloaded ISO checks the sanity of the file on your hard disk.
2) Performing an MD5 check on the burnt CD checks the sanity of the installation media.
3) (1) and (2) are two different things.
Well aware of that, off to check my sanity
Mr Green
Offline
Offline
Shouldn't the result be different? Doesn't the iso file have a header or metadata or something?
The results should be identical, otherwise what I suggested wouldn't make much sense .
Think about it for a second: the same way you can dd a cd or DVD to a file on your hard disk that's an identical image.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Yes, I also know that, but checking the USB stick doesn't work the same way than checking the CD. My interest for this sort of manifestly "boring" operation can probably be explained by my background of a few years of almost exclusive use of RHEL and CentOS. The first thing these enterprise-class distros do is launch a media sanity check when booting the installer.
http://www.microlinux.fr/linux_aux_peti … #integrite
Last edited by kikinovak (2011-01-10 18:49:26)
Dyslexics have more fnu.
Offline
[karol@black isos]$ type cdr
cdr is a function
cdr ()
{
cdrecord -v blank=fast padsize=63s -pad -dao -eject dev=/dev/sr0 "$1"
}
IIRC I got it from http://www.troubleshooters.com/linux/coasterless.htm - it comes as the top result of googling for "md5sum burned cd linux".
[karol@black isos]$ md5sum geexbox-1.2.4-en.i386.glibc.iso
a1577e91983ffe64e25cf7ae14269de9 geexbox-1.2.4-en.i386.glibc.iso
[karol@black isos]$ dd if=/dev/sr0 bs=2048 count=9691 | md5sum
a1577e91983ffe64e25cf7ae14269de9 -
9691+0 records in
9691+0 records out
19847168 bytes (20 MB) copied, 9,25955 s, 2,1 MB/s
Shouldn't the result be different? Doesn't the iso file have a header or metadata or something?
You are of course right.
Note the lack of 'count='.
[karol@black isos]$ dd if=/dev/sr0 bs=2048 | md5sum
a32500c8b27d088918a281ad17ee68ca -
9754+0 records in
9754+0 records out
19976192 bytes (20 MB) copied, 11,4769 s, 1,7 MB/s
The records mentioned are those actually burned to disc. 'cdrecord -v' gives you plenty of info, like
...
Total size: 21 MB (02:10.05) = 9754 sectors
Lout start: 22 MB (02:12/04) = 9754 sectors
...
If the number of records = the number of sectors, things should be OK.
Offline
Come on guys. What's the point of piping dd output to md5sum? That's as redundant and inefficient as using cat and grep together.
As said before, just use md5sum, you might need to eject the CD/DVD before checksumming though.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Let's see that again, slow motion this time
[karol@black isos]$ md5sum geexbox-1.2.4-en.i386.glibc.iso
a1577e91983ffe64e25cf7ae14269de9 geexbox-1.2.4-en.i386.glibc.iso
[karol@black isos]$ md5sum /dev/sr0
a32500c8b27d088918a281ad17ee68ca /dev/sr0
http://www1.geexbox.org/releases/1.2.4/ … 2.4.md5sum
Yes, I did eject after burning.
Offline
Come on guys. What's the point of piping dd output to md5sum?
In theory, you are right.
In practice, I get I/O errors when using md5sum directly on *some* drives, whereas the dd method always works. Don't ask me why.
Dyslexics have more fnu.
Offline
I get I/O errors when using md5sum directly on *some* drives, whereas the dd method always works. Don't ask me why.
I get them too if I omit the '-dao'.
There should be 9691 records:
[karol@black isos]$ dd if=/dev/sr0 bs=2048 count=9691 | md5sum
dd: reading `/dev/sr0': Input/output error
cf5f25f5c3061345095a8092dd13cf00 -
9690+0 records in
9690+0 records out
19845120 bytes (20 MB) copied, 15,8578 s, 1,3 MB/s
[karol@black isos]$ md5sum /dev/sr0
md5sum: /dev/sr0: Input/output error
EDIT: Eureka! Omitting the padding, but keeping the -dao makes 'md5sum /dev/sr0' work!
Last edited by karol (2011-01-13 07:31:58)
Offline
Pretty bizarre, don't know what's up with that.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
Pretty bizarre, don't know what's up with that.
Me neither but I'm not in the mood to hunt down obscure pseudo-bugs. At least for me '-dao' makes it work, and the padding actually breaks things.
Offline