-   Slackware (
-   -   How can I use trim with luks+lvm on ssd? (

pengStudent 05-14-2013 05:48 PM

How can I use trim with luks+lvm on ssd?
I recently replaced my laptop HDD with an SSD and installed Slackware64 14 using README_CRYPT.TXT to setup luks+lvm. I'm trying to enable trim support, I've followed this guide but when I do a dmsetup table --showkeys I don't see discards being allowed. Have I missed a step?

STDOUBT 05-15-2013 04:30 PM

It looks like TRIM needs /etc/crypttab to activate on dm_crypt level. That's problematic I think, because if you used the directions from the section in README_CRYPT.TXT called "Combining LUKS and LVM", then "/etc/crypttab" is not used....
Not sure where to go from here, I don't have any SSD.
Hope this helped some.

pengStudent 05-15-2013 06:00 PM

Yea, I was thinking the same thing. Not sure how to make it read the /etc/crypttab file.

dolphin77 05-16-2013 03:19 AM

EDIT: Sorry, guys, forgot to mention. I had to hack init script in /boot/initrd-tree, in order t make it work. Probably it's time to ask Eric to add this option to his great mkinitrd package.

I changed:

/sbin/cryptsetup ${LUKSKEY} luksOpen ${LUKSDEV} ${CRYPTDEV} </dev/tty0 >/dev/tty0 2>&1

/sbin/cryptsetup ${LUKSKEY} luksOpen --allow-discards ${LUKSDEV} ${CRYPTDEV} </dev/tty0 >/dev/tty0 2>&1
now fstrim -v /
works for me.

EDIT2: it looks like it is better to leave everything as is (without working trim). Then periodically - once a week or monthly to boot from external drive, manually mount encrypted partitions with --allow-discards and run fstrim manually.

STDOUBT 05-16-2013 04:26 AM

In the link you posted, username Exon (on that page's comments section) posted links to two different pages which might help. Thanks for making your post I was not aware of this issue, and was already leery of SSDs.

pengStudent 05-16-2013 12:15 PM

Thanks for the insight guys. And thanks dolphin77 for the tip on using an external boot option, I'll go with this option for now.

All times are GMT -5. The time now is 09:10 AM.