# Verify optical media data integrity



## Seeker (Jan 11, 2010)

I've burned .iso image to CD-RW with _burncd_
Now I wana compare optical media, to that file.iso :stud

So I can ensure that, there are no data read errors, on optical media.

How do I do that? :stud


----------



## DutchDaemon (Jan 11, 2010)

Use md5(1) and/or sha256(1) to get hashes of the original and the copy?

Something like:


```
md5 file.iso /mnt/cdrw/file.iso
sha256 file.iso /mnt/cdrw/file.iso
```

This should produce two sets of identical hashes.


----------



## Seeker (Jan 11, 2010)

I can't use yours method, as once burned file.iso to optical media, does not contain file.iso, as it is image.

So newly burned and mounted optical media contains list of files and not file.iso on which I could use md5 or sha256

So, yours method is applicable only after this:

```
# dd if=/dev/acd0 of=filename.iso bs=2048
```
Now I can use:

```
# md5 filename.iso already_burned.iso
# sha256 filename.iso already_burned.iso
```


----------



## Ruler2112 (Jan 11, 2010)

In Linux (and probably BSD as well) you can md5sum an unmounted device and it'll do exactly what you want.


```
md5sum /dev/scd0 file.iso
```


I haven't tried it, but you could probably pipe the output of a dd command into md5sum to bypass writing to disk.  Something like:


```
dd if=/dev/acd0 bs=2048 |md5;md5 file.iso
```

Again, I have not tested this, so I don't know if it would work or not.  Don't see why not though.


----------

