How to view the btrfs checksum of a file

btrfschecksum

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)?

Best Answer

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.