Enabling trim in encrypted manjaro linux installation

fstrim.service unit contents:

Description=Discard unused blocks

ExecStart=/sbin/fstrim -a

And fstrim.timer contents:

Description=Discard unused blocks once a week



So it runs the fstrim command once a week, so it should also work manually too for it to automatically work.

Running sudo /sbin/fstrim -a manually gives me no output though.

You can change the timer to daily, but don’t edit it just like that, because a systemd update will override your edits. Do it like this: https://wiki.archlinux.org/index.php/systemd#Drop-in_files

No, put nothing about trim in there.
I don´t use cron for it. Doing it manually when i think it´s needed.

Thx will look into that, but first need to make the fstrim command works on my root filesystem.

To recap this is all that is applied/done so far:

  • Ran hdparm -I /dev/sda | grep TRIM and my ssd reports:
    * Data Set Management TRIM supported (limit 8 blocks)
    My ssd supports trim.

  • In my /etc/default/grub file I have added: cryptdevice=cryptdevice=/dev/disk/by-uuid/xxx:cryptManjaro allow-discards (removed root_trim=yes)

  • In /etc/lvm/lvm.conf I have issue_discards = 1

Running fstrim -av reports back /boot: 129.8 MiB (136128512 bytes) trimmed so it only recognized my boot partition as a fileystem which is supported.

This is confirmed with running sudo fstrim -v / again which still gives message: fstrim: /: the discard operation is not supported.

Still something missing here. :sweat:

After having read the advice on the following blog post:


I also tried to include the following lines in /etc/crypttab:

root_sda UUID=xxx none luks,discard
root_sda /dev/sda2 none luks,discard

Didn’t work out unfortunately.

What filesystem are you using? Just to make sure, TRIM is only supported in these filesystems:
Ext4, Btrfs, FAT, GFS2, JFS, and XFS. Are you using ext2 on your root?

Thx for thinking with me, I am using ext4 so shouldn’t be it.

Maybe you should remove the discards option from your grub and update the grub, reboot first. The error is saying discards option not supported there.

1 Like

Also read here: https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard.2FTRIM_support_for_solid_state_drives_.28SSD.29

1 Like

For the main cryptdevice configuration options before the :allow-discards see Dm-crypt/System configuration.
If you are using a systemd based initrd, you must pass:


Don’t completely understand this, do you have an idea where I should put this?

I think in your grub. Here’s the man page: https://www.freedesktop.org/software/systemd/man/systemd-cryptsetup-generator.html

1 Like

Thanks much appreciated, I’m going to figure this out once I have more time and report back.

1 Like

After an update/restart/change it magically started working without last configuration change.

I have the same issue, is there a way to know how did you do, please? I’m a little lost with all the possible change to do between the grub file, crypttab etc… thanks

Definitive guide:

Run hdparm -I /dev/sda | grep TRIM and make sure ssd reports:

Data Set Management TRIM supported (limit 8 blocks)

In my /etc/default/grub file I have:


After this run:

sudo update-grub

In /etc/lvm/lvm.conf I have:

issue_discards = 1

This should be enough to run trim with sudo fstrim -v / or sudo fstrim -av.

Additionally you can set trim timer to make it run once a week.

sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.service


it worked perfectly : big thanks @Mastertech and to all who helped to track the problem :smiley:

Please don’t forget to put the topic as solved. There is a button at the bottom of the post to mark a post as solution.
Mark the post that solved your problem. :slight_smile:

hello @kouros17 I think you’re talking to @Mastertech because I am not the one who begun the discussion… so I can’t mark the discussion as solved :wink:

1 Like

Sorry, just to be clear:

Did you leave the GRUB_CMDLINE_LINUX_DEFAULT="" as is? It say “quiet cryptdevice=UUID=023… Et cetera” by default on my system.

UPDATE: figured it out. I added “:allow-discards” to the GRUB_CMDLINE_LINUX_DEFAULT line, like this; “cryptdevice=UUID=luks-0123456etcblabla:allow-discards root-etc…” so left the rest of the line after that as is. Then did everything as stated after (lvm.conf, fstrim.timer) and it works now.

Couldn’t figure this out for so long, nothing definitive on the wiki’s or fora, reading about crypttab but that never actually working… You have no idea. And then it turns out to be a few simple steps! Love Manjaro even more now. From what I read it seems to be much more of a hassle on other distro’s.


Forum kindly sponsored by