...
This can be done two ways:
Get the information from the DVD itself. This can be done using the isoinfo command:
isoinfo -i <DVD device file> -d
[note blocksize and number of blocks]
dd if=<DVD device file> bs=<block size> count=<number of blocks> status=noxfer | md5sum
For example
isoinfo -i /dev/sr0 -d
[snip]Logical block size is: 2048
Volume size is: 351894
[snip]
dd if=/dev/sr0 bs=2048 count=351894 status=noxfer | md5sum
bcee4c03b704a9b62988505b7d8f3069 -
- Get the information from the .iso file.
==> If the .iso file is on a mounted file system:
...
dd if=<DVD device file> | head -c $(stat --format=%s <path of .iso>) | md5sum
For example:
dd if=/dev/sr0 | head -c $(stat --format=%s ubuntu-12.04-alternate-i386.iso) \
| md5sum
==> If the .iso file is available online:
...
wget http://releases.ubuntu.com/precise/ubuntu-12.04.2-alternate-i386.iso
[snip]
Length: 725921792 (692M) [application/x-iso9660-image]
[snip]
[Ctrl+c to cancel]
dd if=/dev/sr0 | head -c 725921792 | md5sum
Byte-by-byte comparison
If the .iso file is on a mounted file system then
cmp <DVD device file> <path of .iso>
If the command ends with "EOF on <path of .iso>" or with no output then the DVD is verified.
For example
cmp /dev/sr0 ubuntu-12.04-alternate-i386.iso
[no output]
echo $? # Just checking
0