First you need to find out how many 2048-sized blocks the ISO file takes up. Simply divide the size of the file by 2048. For example, for the Debian Etch DVD disc 1, the resulting number is 2294149.
Then, you find the md5sum of the CD or DVD inside your drive (in the following example,
$ dd if=/dev/dvd bs=2048 count=2294149 | md5sum
If the resulting md5sum matches the one of the original ISO file, the write was successful.
A more detailed guide on verifying burned CD data can be found here.