luks2 and discard/trim not working

Nikolay Kichukov <[email protected]>
Newsgroups gmane.linux.kernel.device-mapper.dm-crypt
Organization Oldum Networks
Message-ID <[email protected]>
Hello folks,

Recently, I upgraded to LUKS2 on a NVME SSD disk and noticed that fstrim
does not work. Surely it was running fine with LUKS1.

Here are some more details:

GNU/Gentoo Linux
kernel: 5.5.13-gentoo-x86_64
sys-fs/cryptsetup-2.2.2

NVME supports discard and fstrim on filesystem on nvme0n1p2(without
LUKS2 encyption) works fine:

NAME         DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
nvme0n1             0      512B       2T         0
├─nvme0n1p1         0      512B       2T         0
├─nvme0n1p2         0      512B       2T         0
└─nvme0n1p3         0      512B       2T         0
  └─root_dif        0        0B       0B         0
    └─root          0        0B       0B         0

dmsetup table /dev/mapper/root | grep allow
0 947028136 crypt capi:rfc7539(chacha20,poly1305)-random
:32:logon:cryptsetup:6ae40ec7-1b4c-40ea-871b-d13c9ae66b92-d0 0 254:0 0
2 allow_discards integrity:28:aead

cryptsetup status root
/dev/mapper/root is active and is in use.
  type:    LUKS2
  cipher:  chacha20-random
  keysize: 256 bits
  key location: keyring
  integrity: poly1305
  device:  /dev/nvme0n1p3
  sector size:  512
  offset:  0 sectors
  size:    947028136 sectors
  mode:    read/write
  flags:   discards 

However:
fstrim -v /
fstrim: /: the discard operation is not supported

Any ideas?

Thanks,
-Nikolay
_______________________________________________
dm-crypt mailing list
[email protected]
https://www.saout.de/mailman/listinfo/dm-crypt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.