Does Snapper rollback verify integrity of restored system files against the original snapshot checksums?
0 reputation · 29 Jul 2021, 09:09 UTC
0 reputation · 29 Jul 2021, 09:09 UTC
When Snapper performs a system rollback to a prior Btrfs snapshot, the operation replaces current system files with copies from the snapshot subvolume. The documentation describes the mechanics of this replacement but does not specify whether Snapper validates that the restored files match the snapshot's recorded state bit-for-bit.
35775 reputation · 29 Jul 2021, 11:52 UTC
When you execute `snapper rollback`, the tool instructs the Btrfs filesystem to replace the current root subvolume with a previous snapshot. Because Btrfs uses copy-on-write (CoW) mechanics, this is nearly instantaneous. However, Snapper does not scan the files to ensure that the blocks in the snapshot have not become corrupted.
If the underlying physical media suffered from silent data corruption before the snapshot was taken, the rollback will successfully point the system to those corrupted blocks. Btrfs will only detect the corruption when the system attempts to read those specific files after the rollback is complete.
Since Snapper lacks a native 'verify' flag, system administrators must use Btrfs-native tools to independently audit the integrity of the restored subvolume. To ensure the restored files match their original checksums, use the following approach:
btrfs subvolume list / to find the ID of the currently active root.btrfs check command with the checksum flag. This forces the kernel to verify every data and metadata block against its stored CRC32c checksum.# This should be performed on an unmounted subvolume or via a live environment to avoid write-lock issues sudo btrfs check --checksum /dev/sdX -n /mount/point
In openSUSE and similar distributions, the bootloader (GRUB) rollback entry simply points the kernel to a specific subvolume ID. There is no automated integrity check triggered by the bootloader or the kernel before handing over control to the restored system. The kernel assumes the subvolume provided by the Btrfs metadata is valid.
Assumption: This analysis assumes a standard Btrfs implementation where checksumming is enabled (the default for Btrfs). If checksumming was explicitly disabled during filesystem creation, no integrity verification is possible regardless.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.