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

    Trim for SSD

    Scheduled Pinned Locked Moved Hardware
    18 Posts 7 Posters 6.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.
    • W
      Waqar.UK
      last edited by

      Fro above  https://forum.pfsense.org/index.php?topic=66622.0

      jeppe67 says

      It´s very simple to add TRIM to SSD disks now, it´s just hard to find out how in the first place.
      Here´s what I did today:
      Login with SSH and open the shell.
      Run /usr/local/sbin/ufslabels.sh
      Add the line ahci_load="YES" to /boot/loader.conf.local
      reboot the machine
      Login with SSH and open the shell
      touch /root/TRIM_set; /etc/rc.reboot

      Once the machine has rebooted check the status with: tunefs -p /
      [2.1-RELEASE][admin@pfSense.hemma]/root(1): tunefs -p /
      tunefs: POSIX.1e ACLs: (-a)                                disabled
      tunefs: NFSv4 ACLs: (-N)                                  disabled
      tunefs: MAC multilabel: (-l)                              disabled
      tunefs: soft updates: (-n)                                disabled
      tunefs: gjournal: (-J)                                    disabled
      tunefs: trim: (-t)                                        enabled
      tunefs: maximum blocks per file in a cylinder group: (-e)  2048
      tunefs: average file size: (-f)                            16384
      tunefs: average number of files in a directory: (-s)      64
      tunefs: minimum percentage of free space: (-m)            8%
      tunefs: optimization preference: (-o)                      time
      tunefs: volume label: (-L)

      How do I do "Login with SSH and open the shell"?

      1 Reply Last reply Reply Quote 0
      • BabizB
        Babiz
        last edited by

        @kpa:

        Chances are that you don't actually need TRIM. If the filesystems are not really full the disk will have large amounts of unused space that the wear leveling system can use.

        I play with trim and at the end I discovered that my ssd does not support trim function, on the other hand use tunefs bribed me the partition, and I had to reinstall the pfs.

        Good luck…

        1 Reply Last reply Reply Quote 0
        • K
          kejianshi
          last edited by

          I us SLC in mine with no trim

          Most people don't want to buy that.  Do you have an SLC drive also?

          1 Reply Last reply Reply Quote 0
          • W
            Waqar.UK
            last edited by

            Re install - that does not sound good at all.
            but I use a recent Sandisk 64GB SSD as my boot drive - does that 'qualify' for no need for trim?
            It is this one  https://www.amazon.co.uk/SanDisk-SSD-Sata-2-5-inch-Internal/dp/B007ZWLRSU

            1 Reply Last reply Reply Quote 0
            • K
              kejianshi
              last edited by

              If its an MLC or TLC drive it more than likely supports and needs TRIM.

              1 Reply Last reply Reply Quote 0
              • K
                kpa
                last edited by

                @Babiz:

                @kpa:

                Chances are that you don't actually need TRIM. If the filesystems are not really full the disk will have large amounts of unused space that the wear leveling system can use.

                I play with trim and at the end I discovered that my ssd does not support trim function, on the other hand use tunefs bribed me the partition, and I had to reinstall the pfs.

                Good luck…

                You reinstalled for no good reason, you could have just turned TRIM off by booting into the single user mode and turning it off with tunefs.

                1 Reply Last reply Reply Quote 0
                • W
                  Waqar.UK
                  last edited by

                  My SSD is as I have posted before? So do I have to trim the SSD or leave it as is?

                  1 Reply Last reply Reply Quote 0
                  • K
                    kejianshi
                    last edited by

                    I couldn't find a spec on it.  Not a complete spec anyway.

                    1 Reply Last reply Reply Quote 0
                    • ?
                      Guest
                      last edited by

                      @Waqar.UK:

                      My SSD is as I have posted before? So do I have to trim the SSD or leave it as is?

                      • create a configuration backup (.xml file)

                      • prepare a USB stick to boot and install from it

                      • read this post How to enable TRIM

                      • and it will be done in several minutes

                      • otherwise you could reinstall it fast and play back the configuration backup!

                      1 Reply Last reply Reply Quote 0
                      • W
                        Waqar.UK
                        last edited by

                        @BlueKobold:

                        @Waqar.UK:

                        My SSD is as I have posted before? So do I have to trim the SSD or leave it as is?

                        • create a configuration backup (.xml file)

                        • prepare a USB stick to boot and install from it

                        • read this post How to enable TRIM

                        • and it will be done in several minutes

                        • otherwise you could reinstall it fast and play back the configuration backup!

                        What do I create a USB stick from?
                        since I have a working stable (latest) pfsense setup - I cannot understand why I need to install again.
                        I have a backup of my configuration file (xml file).

                        1 Reply Last reply Reply Quote 0
                        • opticalcO
                          opticalc
                          last edited by

                          @kpa:

                          Chances are that you don't actually need TRIM. If the filesystems are not really full the disk will have large amounts of unused space that the wear leveling system can use.

                          so the SDD just does this automatically?  Im putting together my first system, just ordered a Kingston SSDNow V+200 90GB SATA III 6Gb/s 2.5" Solid State Drive SVP200S3/90G.

                          just trying to determine if i need to enable trim or not (this will be my first pfsense device).  are we presented with the option during install?

                          1 Reply Last reply Reply Quote 0
                          • K
                            kpa
                            last edited by

                            @opticalc:

                            @kpa:

                            Chances are that you don't actually need TRIM. If the filesystems are not really full the disk will have large amounts of unused space that the wear leveling system can use.

                            so the SDD just does this automatically?  Im putting together my first system, just ordered a Kingston SSDNow V+200 90GB SATA III 6Gb/s 2.5" Solid State Drive SVP200S3/90G.

                            just trying to determine if i need to enable trim or not (this will be my first pfsense device).  are we presented with the option during install?

                            All SSDs have automatic wear leveling. What TRIM does is to mark disk blocks that are no longer in use as empty so that the wear leveling has more free space to play with. If your disks are mostly empty the wear leveling will never come to a situation where the unused blocks become scarce and there's no reason to enable TRIM.

                            V 1 Reply Last reply Reply Quote 0
                            • W
                              Waqar.UK
                              last edited by

                              I sse where you come from. My sandisk 64GB SSD only uses less than 4GB for my pfsense system.

                              1 Reply Last reply Reply Quote 0
                              • V
                                Visseroth @kpa
                                last edited by

                                This post is deleted!
                                1 Reply Last reply Reply Quote 0
                                • V Visseroth referenced this topic on
                                • V Visseroth referenced this topic on
                                • First post
                                  Last post
                                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.