Enabling Automatic Block Discard Using the fstrim Systemd Timer

WARNING:

This documentation is a draft and is not meant for production use. Branch: OL10-FSADMIN

Configure the fstrim systemd timer unit to periodically trim unused blocks on a file system.

Enabling the fstrim timer unit automate the discard process, ensuring that the file system remains optimized over time. The default timer unit is configured to run the fstrim operation weekly, but you can change the frequency by creating a systemd override drop-in unit and setting the OnCalendar directive.

  1. To enable the fstrim timer unit, run:
    sudo systemctl enable --now fstrim.timer                        
  2. To verify that the fstrim timer unit is enabled and active, run:
    sudo systemctl status fstrim.timer