Linux – Size difference between an iso file burnt to a cd and the file retrieved with dd

dddvdisolinux

I have an iso file (foo.iso) that I burnt to a dvd with the command :

growisofs -dvd-compat -Z /dev/cdrom=foo.iso

I then tried the command

dd if=/dev/cdrom of=foo2.iso

However, foo2.iso is larger by a few kB. What explains this difference? How can I retrieve the original file from a cd?

EDIT: Simply removing the extra bytes from foo2.iso gives the original file as proven by a checksum. So another question: Is foo2.iso a valid iso file even with the extra junk bytes? This would be important in case I don't have access to the original file's size.

Best Answer

What dd reads when you run dd if=/dev/cdrom of=foo2.iso is not a file (there is no such thing on a physical CD), but a number of 4KB sectors. If the length of the image file you wrote is not an exact multiple of 4KB = 4096, there will be some padding at the end. You can safely ignore it.

Related Question