LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   How can I use trim with luks+lvm on ssd? (http://www.linuxquestions.org/questions/slackware-14/how-can-i-use-trim-with-luks-lvm-on-ssd-4175461978/)

pengStudent 05-14-2013 04: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 http://blog.neutrino.es/2013/howto-p...m-and-dmcrypt/ but when I do a dmsetup table --showkeys I don't see discards being allowed. Have I missed a step?

STDOUBT 05-15-2013 03: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 05:00 PM

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

dolphin77 05-16-2013 02:19 AM

http://blog.neutrino.es/2013/howto-p...m-and-dmcrypt/

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:
Code:

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

/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 03:26 AM

pengStudent,
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 11:15 AM

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 05:22 AM.