Enabling TRIM for SSDs after installation

Recently I reinstalled my Antergos (Arch Linux). It features a nice installer, Cnchi, with support for full disc encryption with LUKS and LVM. Unfortunately, it does not activate TRIM support for SSDs by default. To do that post-installation the three following steps are required.

  1. For every physical partition in /etc/fstab add the discard option.
  1. Make LVM pass through TRIM commands to the underlying partition. Edit /etc/lvm/lvm.conf:
  1. Add a boot parameter in /etc/default/grub so the physical partitions are mounted with the allow-discard option enabled.

Rebuild the grub config.

grub-mkconfig -o /boot/grub/grub.cfg

If you now reboot and try sudo fstrim -v / things should go smoothly.