I want to use optical media for backups and hence created a luks image equivalent to that of a 80 min CD-ROM and recorded it twice using the cdrecord
# first run
$ cdrecord -v dev=0,0,0 image.luks
# second run
$ cdrecord -v speed=2 dev=0,0,0 -date image.luks
When afterwards trying to mount it, I receive an error message
$ sudo cryptsetup luksOpen /dev/sr0 samples
Device /dev/sr0 is not a valid LUKS device
This had me curious, so I extracted all data from the CD-ROM
$ sudo cat /dev/sr0 >>image.luks.cd
After that I compared the original with the retrieved data and found this
benj@benj-xps13:~# stat --format=%n:%s *.luks*
image.luks:736960512
image.luks.cd:736960512
benj@benj-xps13:~# openssl sha1 *.luks*
SHA1(image.luks)= d5821b72310e278540ae33f8249f01d1bda1b050
SHA1(image.luks.cd)= a89eff5554b7ca3fb4ea4411d06ce7c525d93306
benj@benj-xps13:~# diff <(hexdump image.luks) <(hexdump image.luks.cd)
1046734,1046735c1046734,1046735
< 1000420 4b16 5656 f9ef 6ed7 7a3d 6be9 d42a 6ed0
< 1000430 503e 57ee ad67 f13f 882c 7588 430e 5c38
---
> 1000420 e485 37f4 eb41 ff7b 7c3b 67ab ff6c 88c2
> 1000430 fada 3ad5 439a 3256 61db cf41 c7f4 043a
1046755c1046755
< 1000570 55c4 7a6b a09c c908 5b85 4612 6f74 4090
---
> 1000570 cdf5 7de6 7be1 4d91 37d7 2024 9e93 fc8c
1046795c1046795
< 10007f0 8966 7cae 0824 3e1c 03da 5a96 9f87 e16a
---
> 10007f0 ea7e af7f a936 c578 9e42 6da5 1d3c 031a
so a few bytes were altered during the recording process. What is the reason for that and how can I prevent it?