You are not logged in.

#1 2017-06-29 12:12:04

daankata
Member
Registered: 2017-05-21
Posts: 47

dm-crypt discard option on SSD drives

Hello!
I am using LVM on LUKS(dm-crypt) on my system. The LVM contains the root, home and var partition. After installing the system I followed the Arch Wiki manual and changed the value of "issue_discards" from 0 to 1 in /etc/lvm/lvm.conf. Do I have to pass the discard option in /etc/crypttab too? I am not using continuous TRIM, I am using periodic TRIM. Also in the wiki there is the statement

- For non-root filesystems, configure /etc/crypttab to include discard in the list of options for encrypted block devices located on a SSD (see Dm-crypt/System configuration#crypttab).
- For the root filesystem, follow the instructions from Dm-crypt/TRIM support for SSD to add the right kernel parameter to the bootloader configuration.

I am using LVM so how to pass the discard option to non-root/root filesystem? When I open /etc/crypttab there isn't anything except comments. My root partition is not listed there.

Offline

#2 2017-06-29 12:31:01

loqs
Member
Registered: 2014-03-06
Posts: 17,534

Offline

#3 2017-06-29 13:09:53

frostschutz
Member
Registered: 2013-11-15
Posts: 1,425

Re: dm-crypt discard option on SSD drives

The issue discards in lvm.conf will trim LV on lvremove, lvresize (shrink), pvmove and other such actions. Enabling that means you won't be able to undo any changes to your LV structure (after a botched lvresize the data is already gone).

For LVM, it's better to leave issue_discards=0. If you wish to trim unused LVM space you can temporarily create a 100%FREE LV and blkdiscard that.

If you want TRIM to work with LUKS you have to enable allow discards for cryptsetup. If you use that there is also not much point in wiping the drive before hand as it will be trimmed anyways.

Last edited by frostschutz (2017-06-29 13:10:13)

Offline

Board footer

Powered by FluxBB