Fedora 23 TRIM SSDs

running fedora 23 with full-disk encryption on an SSD – no TRIM support?

fstrim: /home: the discard operation is not supported

now.. it is not in fstab because we run crypto so let’s do this the right way: (I think)
sources: neutrino.es
and christophersmart.com

1) in /etc/crypttab add “discard” to your crypto partition


luks UUID=4aa302cb-4b9a-413b-a862-9856ed5ddbba none discard

2) in /etc/lvm/lvm.conf, at the end of the ‘devices’ section, set “issue_discards = 1

3) rebuild initramfs and reboot
grubby --update-kernel=ALL --args=rd.luks.options=discard
dracut -f
reboot

now it should work, check with fstrim –verbose –all

# fstrim –verbose –all
/home: 53,9 GiB (57874288640 bytes) trimmed
/boot: 324,6 MiB (340356096 bytes) trimmed
/: 21,9 GiB (23504187392 bytes) trimmed

4) use systemctl to run a weekly job for that
systemctl ebable fstrim.timer
systemctl start fstrim.timer
systemctl status fstrim.timer

result:

# systemctl status fstrim.timer
● fstrim.timer – Discard unused blocks once a week
Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: disabled)
Active: active (waiting) since Do 2016-06-16 07:27:27 CEST; 15min ago
Docs: man:fstrim

Jun 16 07:27:27 anakin systemd[1]: Started Discard unused blocks once a week.
Jun 16 07:27:27 anakin systemd[1]: Starting Discard unused blocks once a week.

UPDATE: Seems Fedora 24 understands the kernel boot argument so:
edit /etc/default/grub and add rd.luks.options=discard to the end

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=”console”
GRUB_CMDLINE_LINUX=”rd.lvm.lv=fedora/root rd.luks.uuid=luks-4aa302cb-4b9a-413b-a862-9856ed5ddbba rd.lvm.lv=fedora/swap r
hgb quiet rd.luks.options=discard
GRUB_DISABLE_RECOVERY=”true”

now just rebuild grub and the initramfs step should not be neccessary, anymore… (you do need the lvm part and the systemd timer)
grub2-mkconfig -o /boot/grub2/grub.cfg