You are not logged in.

#1 2017-10-20 00:21:04

rbaj
Member
Registered: 2016-01-27
Posts: 36

[SOLVED] fstrim with LVM on LUKS: discard operation not supported

I've installed LVM on LUKS. I'd like to enable periodic trim. Currently this only works for the unencrypted boot partition:

$ sudo fstrim --verbose --all
/boot: 59.9 MiB (62812160 bytes) trimmed

$ sudo fstrim -v /
fstrim: /: the discard operation is not supported

But the SSD supports trim:

$ sudo hdparm -I /dev/sda | grep TRIM
	   *	Data Set Management TRIM supported (limit 4 blocks)

It's setup in /etc/lvm/lvm.conf:

issue_discards = 1

Kernel parameters are set:

GRUB_CMDLINE_LINUX="cryptdevice=/dev/sda6:vg:allow-discards root=/dev/mapper/vg-root"

Crypttab includes the option from the manpage:

vg	/dev/sda6	     none  	  discard

But still I don't get allow_discards showing up:

$ sudo dmsetup table
vg-root: 0 41943040 linear 254:0 2048
vg: 0 390108767 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 8:6 4096
vg-var: 0 18874368 linear 254:0 41945088
vg-home: 0 329285632 linear 254:0 60819456

Partition layout:

NAME          TYPE  MOUNTPOINT
sda           disk  
├─sda1        part  /boot/efi
├─sda2        part  
├─sda3        part  
├─sda4        part  
├─sda5        part  /boot
└─sda6        part  
  └─vg        crypt 
    ├─vg-root lvm   /
    ├─vg-var  lvm   /var
    └─vg-home lvm   /home

My feeling is this is related to the crypttab. Any pointers?

Thanks

Last edited by rbaj (2017-10-21 17:03:40)

Offline

#2 2017-10-21 17:03:25

rbaj
Member
Registered: 2016-01-27
Posts: 36

Re: [SOLVED] fstrim with LVM on LUKS: discard operation not supported

I'd run mkinitcpio and grub-mkconfig but forgot to grub-install first. All fixed now. (Also it seems that for / on LVM on LUKS you don't need anything in /etc/crypttab.)

Offline

#3 2019-03-07 06:06:50

XoseM
Member
Registered: 2013-08-17
Posts: 11
Website

Re: [SOLVED] fstrim with LVM on LUKS: discard operation not supported

thanks!

exactly the same mistake

Offline

#4 2020-09-12 15:14:24

applejosh
Member
Registered: 2020-09-04
Posts: 1

Re: [SOLVED] fstrim with LVM on LUKS: discard operation not supported

Old thread, but thank you. This was straightforward and immensely helpful.

Offline

Board footer

Powered by FluxBB