Skip to content

Check and attempt to safely repair the Persistent Storage filesystem before mounting it

intrigeri requested to merge 15451-fsck-persistent-storage into stable

Based on !1348 (merged).

This is the first baby step of phase 1.A of #15451. AFAICT, for all the exit codes that we've considered, this would be at least as good as what we currently do (i.e. no fsck at all, and always try to mount).

Corrupted filesystem that e2fsck -p can fix

Corrupt filesystem:

rm -rf /live/persistence/TailsData_unlocked/lost+found

Then it's fixed at activation time:

Jan 18 13:03:16 amnesia tpsd[6137]: INFO:device.py:751: [1] Executing command e2fsck -f -p /dev/dm-0
Jan 18 13:03:16 amnesia tpsd[6817]: TailsData: /lost+found not found.  CREATED.
Jan 18 13:03:16 amnesia tpsd[6817]: TailsData: 14/261120 files (0.0% non-contiguous), 20476/1044224 blocks
Jan 18 13:03:16 amnesia tpsd[6137]: WARNING:device.py:763: [1] e2fsck returned 1

… and mounting succeeds. Good news, because this is the whole point of this MR :)

Corrupted filesystem that e2fsck -p cannot fix

Corrupt filesystem:

dd if=/dev/urandom of=/dev/mapper/TailsData_unlocked bs=1k seek=10 count=4k

Then both e2fsck and mounting fail, as expected: this MR is not trying to fix that.

Edited by intrigeri

Merge request reports