How to enable TRIM on LVM on LUKS on SSD on Fedora 25 Linux.
If you have an SSD disk in your computer and you are using LVM virtual volumes together with LUKS disk encryption, below you will find how to activate TRIM for better SSD performance and longer lifetime.
Edit /etc/fstab file and append every filesystem with
option:
Example:
UUID=XXXX-XXXX-XXXX-XXXX-XXXX /boot ext4 defaults,discard,noatime 1 2
/dev/mapper/vg_laptop-home /home ext4 defaults,discard,noatime,x-systemd.device-timeout=0 1 2
Edit /etc/lvm/lvm.conf file, set following option:
Edit /etc/crypttab file, append line with
Example:
Edit /etc/default/grub file by adding follwing argument
at the end of
parameter value.
Update GRUB bootloader configuration.
For system with BIOS:
For system with UEFI:
Generate initramfs file by applying command:
Reboot your system:
Test whether TRIM is working:
Edit /etc/crontab file to schedule automatic start of fstrim command.
1 * * * * root fstrim -av >> /home/USERNAME/fstrim.log