Fstrim for SSD



  • It would be nice to have a check box to enable a daily cron for fstrim in the advanced section.  What is fstrim you ask?

    TRIM allows the OS to inform a solid-state drive (SSD) which blocks of data are no longer considered in use and can be wiped internally. Without using TRIM, the SSD speed decreases after a while so if you have a solid-state drive that supports TRIM, you should enable it so your SSD remains fast over time.

    It would mean that fstrim would have to be included in install or possibly a 3rd party package.  A simple cron might look like this:

    #!/bin/sh
    LOG=/var/log/trim.log
    echo "*** $(date -R) ***" >> $LOG
    fstrim -v / >> $LOG



  • Why would it be better to do it in userspace as you describe, rather than natively?

    Please see this http://forum.pfsense.org/index.php/topic,63656.0.html thread for background, but for 2.1 basically all you need to do is:

    
    A) Edit /boot/loader.conf.local to add ahci_load="YES"
    B) Reboot
    C) Perform the TRIM_set action at a shell:
    	touch /root/TRIM_set
         (if you need to remove: 	touch /root/TRIM_unset)
    D) Reboot
    E) Verify if TRIM is enabled with "tunefs -p /"
    

    I haven't checked out the 2.2 installer, but it's likely you will see an option to enable TRIM during install with 2.2


Log in to reply