Sample Header Ad - 728x90

How to enable discards on encrypted root

3 votes
1 answer
9305 views
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 refresh*device*), 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](https://jschumacher.info/2016/11/encrypt-an-existing-linux-installation-with-luks-and-lvm/) * [Arch-wiki section](https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard/TRIM_support_for_solid_state_drives_(SSD)) about SSDs and dm-crypt * possibly relevant: (https://unix.stackexchange.com/questions/341442/luks-discard-trim-conflicting-kernel-command-line-options) , (https://unix.stackexchange.com/questions/206754/difference-between-cryptopts-and-crypttab)
Asked by user224348 (446 rep)
Mar 23, 2020, 11:43 AM
Last activity: Jun 20, 2020, 05:18 PM