Btrfs calculates a crc32c checksum for each file. Is there a way I can view what checksum is stored (as opposed to just reading the file and recalculating it)?
- 
        Posted an answer to similar question : superuser.com/a/1030443/44360webminal.org– webminal.org2016-01-24 17:02:43 +00:00Commented Jan 24, 2016 at 17:02
 - 
        1This is a related topic: stackoverflow.com/questions/32761299/…Alexander Pozdneev– Alexander Pozdneev2017-07-30 09:48:32 +00:00Commented Jul 30, 2017 at 9:48
 
3 Answers
Btrfs calculates a crc32c checksum for each file.
This is not correct. Both of the open-source checksumming file-systems (ZFS and BTRFS) calculate a checksum for each logical block (the unnamed source Awe used is correct). This is a checksum of the on-disk data.
If the file-system has compression enabled (an increasingly common setting), this checksum is of the data after compression. This means that, even if the file fits in one logical block, it's possible (and increasingly likely) that the file-system's checksum data will be useless to you.
If you need a file checksum, the best way to get it would be to calculate it.
From a similar answer by jlp at Server Fault:
I don't believe it is possible to extract the block level checksums from a ZFS filesystem, but since the checksums are at the block level, not the file level, it probably wouldn't help you anyway.
Meaning: checksums are not created per file by btrfs. 
It is mentioned by lakshmipathi in a question on Super User
that there is a patch to add a functionality to the inspect-internal subcommand:
btrfs inspect-internal dump-csum
This dumps – for all blocks being occupied by a given file – the block checksums. Plural, unless the file fits into one block.
I think this isn't possible via btrfs CLI, but here there is a source code that, I hope, could help you to read chechsum for a single block in a btrfs filesystem. Needs root.