[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fstrim and Luks / dm-raid



Le 05/10/2019 à 15:55, Reco a écrit :

On Sat, Oct 05, 2019 at 02:52:55PM +0200, Erwan David wrote:
I've got a computer with 3 SSD in RAID5 (dm-raid) containing a LUKS
partition, then a lvm

dm-raid (device-mapper) or mdraid (mdadm) ?

Is fstrim useful in suc a case ?

It's disabled by default, but you can enable by setting
"issue_discards=1" in lvm.conf, and by adding "discard" option to your
crypttab. There's no SSD-specific mdraid configuration.

Actually there is. mdraid and dm-raid have discard disabled by default with RAID4/5/6 for safety reasons. One must pass the parameter devices_handle_discard_safely=Y to the module raid456 or dm-raid respectively to enable it.

TRIM/discard needs special care with parity RAID (4/5/6). Discarded data are useless for the upper layer, but they are still useful for parity calculation. So discard is considered safe only if all drives in the array consistently return zeroes for discarded data reads.

Should I add the discard option in fstab ?

It's safe only if your SSD firmware is sane and does not corrupt your
data while processing TRIM with NCQ enabled.
For instance, some noname Chinese SSD (ADATA, for instance) can corrupt
your filesystem in such circumstances, Samsung 850 PRO should not.
Manual fstrim invocation seems to be safe.

Why should fstrim be safer that the discard mount option ? AFAIK they use the same TRIM command.


Reply to: