Web lists-archives.com

Re: SSD TRIM software raid (mdadm)

Le 09/01/2019 à 22:22, basti a écrit :
I have create a software raid level 1 with mdadm.

One drive is a "classic" HDD.
The 2'nd drive is a SSD with option "write-mostly".

Why did you flag the SSD as write-mostly ? I would have expected the opposite.

Over the raid I have create and LVM with all the partitions (root,swap
and qemu/KVM VM's).

When I understand mdadm the hole space is marked as used.

I don't understand what you mean.

So my question is how useful is fstrim on /dev/mdx and would it relay
trim the SSD?

RAID 1 supports TRIM since kernel 3.7. Since the HDD does not support TRIM, it will make discarded bloc contents inconsistent between the SSD and the HDD but it does not matter.

However you wrote that the RAID device is used by LVM, so you cannot run fstrim on it directly. You must enable TRIM/discard in LVM (see lvm.conf) and run fstrim on LVs which contain mounted filesystems supporting TRIM/discard.