I'm looking for a way to create a virtual block device that when accessed returns the XOR of two block devices. I feel like
dmsetup would be used here somewhere but I can't find anything related to what I want.
Here's basically what I'm looking for
$ xxd /dev/sda # First real device 00000000: 01 23 45 67 .... $ xxd /dev/sdb # Second real device of same size 00000000: ab cd ef ff .... $ xordevices /dev/sda /dev/sdb $ xxd /dev/mapper/sdaxorsdb # Virtual device 00000000: aa ee aa 98 ....
In this example, writing to
/dev/mapper/sdaxorsdb would modify
/dev/sdb in such a way that the xor of
/dev/sdb would be the newly written data.
Is this possible?