1

I have installed system on ext4 filesystem on lvm (vg name encrypted, root is called encrypted-root) on luks. When I'm trying to run fstrim /, I get fstrim: /: the discard operation is not supported.

My /etc/crypttab contains

cryptroot  UUID=5ddb7e3a-dcbe-442d-85e8-359e944d0717  none  luks,discard,lvm=encrypted

/etc/lvm/lvm.conf contains

        issue_discards = 1

/etc/initramfs-tools/conf.d/cryptroot contains only

CRYPTROOT=target=encrypted-root,source=/dev/disk/by-uuid/5ddb7e3a-dcbe-442d-85e8-359e944d0717

(I used update-initramfs -k all -c to create initramfs).

/etc/default/grub contains

GRUB_CMDLINE_LINUX="cryptops=target=encrypted-root,source=/dev/disk/by-uuid/5ddb7e3a-dcbe-442d-85e8-359e944d0717,lvm=encrypted"

I have tried to manually put rd.luks.options=discard as parameter for linux in grub. I have tried refresh option of cryptsetup utility (cryptsetup --allow-discards refreshdevice), but it does not seem to have one (cryptsetup: Unknown action).

Physical device apparently has TRIM support, when I run fstrim /boot it works (it's same device, just not encrypted).

dmsetup table command does not show allow_discards for cryptroot.

When I boot from USB and manually decrypt (with --allow-discards argument to cryptsetup) and mount root partition, it works. I have tried to use --persistent option, but it said that it couldn't make it persistent.

I'm lost. What should I do to make fstrim / work? Something tells me I should somehow modify boot options in grub, but I'm not sure how. I'm also not sure if line in /etc/crypttab is used at all (I changed it to cryptroot after install, it seems to do nothing even if I change it).

I'm running Linux Mint 19.3.

Links:

  • I have followed this guide to encrypt system: link
  • Arch-wiki section about SSDs and dm-crypt
  • possibly relevant: 1, 2
0

I figured out problem was on encryption level. (You can run dmsetup table as root to see if your device shows allow_discards.)

This fixed the problem for me:

  • Edit /etc/initramfs-tools/conf.d/cryptroot, add discard option for particular device. In my case line looked like this: CRYPTROOT=target=encrypted-root,source=/dev/disk/by-uuid/5ddb7e3a-dcbe-442d-85e8-359e944d0717,discard.
  • Run update-initramfs -k all -c. (Maybe make backup first in case there is something wrong with your config and you don't know about it.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.