Does LUKS protect the filesystem integrity?
LUKS formatted with --integrity <algorithm>
option will provide integrity protection for the encrypted volume.
For that to work, --type luks2
must be used when formatting the device (opening of the device formatted with LUKS2 and integrity protection works exactly as for "normal" encrypted devices).
The downside is that the integrity target requires data to be written twice to preserve atomicity of the writes. It is possible to disable this feature (--integrity-no-journal
) with the possible risk of data being lost – mismatches between checksums will be reported as I/O errors on reads. Second downside is that some space is lost to checksums, between 0.1% (for crc32) and 0.78% (for SHA-256).
With Advanced Format drives (4K sectors), it's good idea to also provide --sector-size 4096
as that will ensure block-alignment of virtual blocks to disk-physical blocks.
See FOSDEM presentation.
No, LUKS does not do any integrity checking. Authenticated encryption expands the ciphertext with respect to the plaintext, and LUKS does not have any functionality in place to deal with this. LUKS uses dm-crypt, usually in CBC or XTS mode.