7374756666

Adding discard to luks formatted volumes on Ubuntu Cosmic

I use SSDs on my machines which are luks formatted, to enable TRIM/discard I had to add the discardd option to /etc/crypttab

crypt_nas UUID=887c0b7c-3ef1-499c-a36e-e1842bebf69a none luks,initramfs,discard
crypt_root UUID=0e72d245-104a-4aee-b636-a250b234ce3f none luks,initramfs,discard

There is a warning in the crypttab man page

WARNING: Assess the specific security risks carefully before enabling this option. For example, allowing discards on encrypted devices may lead to the leak of information about the ciphertext device (filesystem type, used space etc.) if the discarded blocks can be located easily on the device later.

In my case this isn't a concern as long as the data is encrypted