SSD data loss issue when using Linux 5.1 kernel, LVM and dm-crypt

In a correction release of the kernel Linux 5.1.5 fixed problem in the DM (Device Mapper) subsystem, which may data corruption on SSDs. The problem started showing up after changes, added to the kernel in January of this year, affects only the 5.1 branch and in the vast majority of cases manifests itself on systems with Samsung SSDs that use data encryption using dm-crypt/LUKS over device-mapper/LVM.

Cause of the problem is too aggressive marking of blocks to be freed via FSTRIM (too many sectors were marked at a time, without taking into account the max_io_len_target_boundary limit). Of the distributions offering the 5.1 kernel, the bug has already been fixed in Fedora, but so far remains uncorrected in ArchLinux (the fix is ​​available, but is currently in the "testing" branch). A workaround for blocking the problem is to disable the fstrim.service/timer service, temporarily rename the fstrim executable, remove the "discard" flag from the fstab mount options, and disable the "allow-discards" mode in LUKS via dmsetup.

Source: opennet.ru

Add a comment