TRIM on LVM+LUKS

Essence_of_War

Platinum Member
Feb 21, 2013
2,650
4
81
I'm running elementaryOS (stable, based on ubuntu 14.04) on a laptop with a Crucial m500. I'm having trouble getting "fstrim" to pass-through to my SSD. Initially, I thought maybe I was hitting the "vendor check", but my /boot appears to trim just fine, so my suspicion was that I messed something up in my luks/lvm layers.

"/" is an ext4 filesystem on of an LVM on top of LUKS encrypted partition.
swap partition is a logical volume on top of the same LUKS encrypted partition.
"/boot" is an ext2 filesystem, that is outside of both the LUKS and LVM.

If I run:
Code:
sudo fstrim -v /boot
Trimming happens and some number of blocks are returned by the verbose output. I think that if the problem was a vendor/model check, this would fail.

If I run:
Code:
sudo fstrim -v /
I get:
Code:
FITRIM ioctl failed: Operation not supported
So far I have:
1) Edited /etc/lvm/lvm.conf to ensure "issue_discards=1".
2) Edited /etc/crypttab to include the discards option, my crypttab looks like:
Code:
MY_PV_NAME UUID=UUID_of_my_encrypted_partition none luks,discard,tries=2 lvm=MY_VG_NAME
3) After editing both of those, I re-built my initramfs:
Code:
update-initramfs -c -k all
Rebooted, and I get the same errors when trying to run fstrim. Did I miss a step or something? I thought I got all of the layers on the same page.