Hello! When I joined Manjaro the 16.06 was the current install media (I choose Manjaro Gnome) and during the graphical installation I opted for encrypting the system.
Now I recently learned that luks by default inhibits trim which is something I actually would want to use on my Samsung 850 EVO SSD.
All the tutorials and guides I found so far (for arch and manjaro) only talk about the /etc/crypttab where I allowed trim for the swap partition, but I fail to figure out how to do that for my / partition as it isn't in crypttab at all. Also setting the rd.luks.options=discard option in Grub does not fix my problem - as it seems that the grub that actually could handle that is not affected by /etc/defaults/grub at all.
For some possible clarification, that is the "1st grub" where the / partition is unlocked:
Usually you don't trim swap, because it's hardly used, it's only used these days for suspend, and suspend on Linux is umstritten anyways, especially if you encrypt, which you should do by default.
Now to trim on linux, why do people tell you it doesn't work on LUKS volumes? Not because it doesn't work, because it does (discard doesn't care about the nature of the discarded data, whether it's encrypted or not), if you put the discard parameter in /etc/fstab, it will use trim on the volumes you've added the parameter to. The reason is that discard basically "abandons" data on storage devices, which means that a clever data thief may get some information out of discarded data, like for instance what kind of filesystem you use, what block size is set, etc. So using discard with LUKS is considered bad security practice.
Now in less critical situations, e.g. encryption for regular use, not for capital secrets, you could just enable discard on the root and home volumes in /etc/fstab. I do that myself. I also schedule for ssd's. As long as the ssd's have less than 1 TB of data on them, I think the security risk of enabling discard on partitions inside of an LVM2 with LUKS, is pretty small. The larger the quantity of discarded data however, the greater the sample size to perform data reengineering on.
I know that it should (will) work (when configured right) - I also know now that the devs of luks disable the pass-through by default because you could be leaking some info when soeone analyses the freed spaces .. bla bla .. I want it to work, but I do not know how to get it to work for / .
Sadly not - that is my fstab and it does not work - it neither did for SWAP before I edited the crypttab
Thanks for explaining how trim isn't a realy danger for my - personal use, none top secret - system; But what I am realy realy hoping for is for some idea or push into the right direction on how to actually get it to work, because as you can see I have "enabled" it but still:
So what is different on my system compared to all of the above you posted, only one thing: in crypttab, I just have "discard" as parameter, instead of "allow-discards", and on my system, it just works. I can also sudo fstrim / --verbose, and after a while it just says how many bytes were trimmed. It should just work, what can I say?
Yeah that's one of those things I always reuse, I've just never thought about it, it has always just worked because it made sense. I always use the same environment and kernel parameters, and always use self-compiled kernels with my own kernel config. In the old days, that was the only way to have a reasonable guarantee of a functional bleeding edge system, and I've always kept doing it, guess it still has some advantages lol
Nice you got it sorted out! Not to nit pick, but isn't it generally advised against to use discard as the way to do trim on most SSD's, I've heard, notably the generation before yours, the Samsung 840 evo/pro? It depends on the specific firmware afaik. Sorry for not providing documentation, am on mobile atm.
Indeed there was once a firmware bug with samsung SSDs, which could lead them to brick when trimed; But the linux gods (aka devs) fixed that by blacklisting those models back than. But now they do support it, and with 250GB trimed it was due needed on mine - as I actually thought it -was- triming the whle time I use the system