Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Fstrim for SSD

    Scheduled Pinned Locked Moved Development
    2 Posts 2 Posters 1.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cherrypie
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • C
        charliem
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.