On 2018-08-10 06:07, Cerem Cem ASLAN wrote:
Original question is here: https://superuser.com/questions/1347843

How can we sure that a readonly snapshot is not corrupted due to a disk failure?

Is the only way calculating the checksums one on another and store it
for further examination, or does BTRFS handle that on its own?

I've posted an answer for the linked question on SuperUser, under the assumption that it will be more visible to people simply searching for it there than it would be on the ML.

Here's the text of the answer though so people here can see it too:

There are two possible answers depending on what you mean by 'corrupted by a disk failure'.

### If you mean simple at-rest data corruption

BTRFS handles this itself, transparently to the user. It checksums everything, including data in snapshots, internally and then verifies the checksums as it reads each block. There are a couple of exceptions to this though:

* If the volume is mounted with the `nodatasum` or `nodatacow` options, you will have no checksumming of data blocks. In most cases, you should not be mounting with these options, so this should not e an issue. * Any files for which the `NOCOW` attribute is set (`C` in the output of the `lsattr` command) are also not checked. You're not likely to have any truly important files with this attribute set (systemd journal files have it set, but that's about it unless you set it manually).

### If you mean non-trivial destruction of data on the volume because of loss of too many devices

You can't protect against this except by having another copy of the data somewhere. Pretty much, if you've lost more devices than however many the storage profiles for the volume can tolerate, your data is gone, and nothing is going to get it back for you short of restoring from a backup.

Reply via email to