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

    TRIM support in pfSense 2.1.1

    Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
    14 Posts 7 Posters 7.8k 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 Offline
      charliem
      last edited by

      @saftig:

      Hi!

      I had a few hiccups when updating from 2.1 to 2.1.1 this morning, so I thought I'd install 2.1.1 from scratch. The old method of enabling TRIM support via TRIM_set has been removed it seems (http://freshbsd.org/commit/pfsense/aa87bae5fc11a857c9dc7793fc4a932cc860e94a), is there any other solution at hand?

      I saw this change on HEAD, but didn't realize 2.1.1 was changed too.  Yes, it was a kludge, but at least it was somewhat documented, and could be done remotely.  Too late now I guess, but I don't think this met the 'bug' criteria, and should not have gone into 2.1.1

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

        @Crounini:

        Is it possible to follow this procedure without execute the tunefs command in single mode ?

        In the worst case, you could revert the patch linked to in the first post.  IE, simply restore the removed text, and proceed based on the v2.1 TRIM howtos.

        1 Reply Last reply Reply Quote 0
        • C Offline
          Crounini
          last edited by

          Thank you Charliem,

          I suppose I could do that after the upgrading… But what will be the behavior with the modified rc file at the next upgrade ?

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

            @Crounini:

            Thank you Charliem,

            I suppose I could do that after the upgrading… But what will be the behavior with the modified rc file at the next upgrade ?

            Nothing … it will be written over again, but by that time your install is done and operating with TRIM support.  If no /root/TRIM_set or /root/TRIM_unset files exist, the patch does nothing.  So, AFAIK, no reason not to revert that patch.

            It's fine to say 'we can do it better', but don't remove features until the new, better ones are available.

            1 Reply Last reply Reply Quote 0
            • Z Offline
              zimba
              last edited by

              Hi,

              I am new to Pfsense and I am trying to follow Saftig's guide to enable TRIM on my SSD. I am trying to make sure that the order is correct when enabling TRIM:

              1. Login with SSH or locally and open a shell

              2. Run /usr/local/sbin/ufslabels.sh

              When I perform step 2, I get the following message. Please see attachment (sorry the image is blurry)

              Do, I commit to this?

              After that, do I run this statement?

              3. 'ahci_load="YES"' to /boot/loader.conf.local

              Thanks in advance! I am running the latest version 2.1.3

              labels.jpg
              labels.jpg_thumb

              1 Reply Last reply Reply Quote 0
              • stephenw10S Offline
                stephenw10 Netgate Administrator
                last edited by

                The message looks correct.

                Steve

                1 Reply Last reply Reply Quote 0
                • A Offline
                  adoucette
                  last edited by

                  I still do not get trim…
                  I'm running a fresh install of pfSense 2.1.3 onto an OCZ Vertex 2 SSD, and have followed:

                  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
                  

                  But when I run tunefs -p /, it shows:

                  [2.1.3-RELEASE][admin@pfsense.localdomain]/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)                                         disabled
                  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)
                  

                  So, I have tried Satig's suggestion (though I tried it through SSH) and when I run

                  /sbin/tunefs -t /
                  

                  I get the message:

                  tunefs: bad trim (options are `enable' or `disable')
                  

                  When instead I enter "/sbin/tunefs -t enable /" at the SSH prompt I get:

                  [2.1.3-RELEASE][admin@pfsense.localdomain]/root(3): /sbin/tunefs -t enable /
                  tunefs: issue TRIM to the disk set
                  tunefs: /dev/ufsid/539c74fd15a8a779: failed to write superblock
                  

                  Still no trim.
                  How can I simply enable Trim?

                  TIA,
                  Ari

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

                    @adoucette:

                    I still do not get trim…

                    So, I have tried Satig's suggestion (though I tried it through SSH) and when I run

                    /sbin/tunefs -t /
                    

                    I get the message:

                    tunefs: bad trim (options are `enable' or `disable')
                    

                    When instead I enter "/sbin/tunefs -t enable /" at the SSH prompt I get:

                    [2.1.3-RELEASE][admin@pfsense.localdomain]/root(3): /sbin/tunefs -t enable /
                    tunefs: issue TRIM to the disk set
                    tunefs: /dev/ufsid/539c74fd15a8a779: failed to write superblock
                    

                    Still no trim.
                    How can I simply enable Trim?

                    You need to run that command at the console, in single user mode not remotely via ssh.  The superblock write fails because the disk is still mounted.

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      adoucette
                      last edited by

                      @charliem:

                      You need to run that command at the console, in single user mode not remotely via ssh.  The superblock write fails because the disk is still mounted.

                      Yes, that fixes it. Thanks.

                      $ 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
                      
                      1 Reply Last reply Reply Quote 0
                      • 3 Offline
                        3vian
                        last edited by

                        I seem to have a problem with the TRIM enabled setting remaining after reboot.

                        Once I executed /sbin/tunefs -t enable / what exactly should I do. I can't run /etc/rc.reboot because I get the following:

                        lockf: cannot open /tmp/config.lock: Read-only file system
                        Cannot reboot at this moment, a config write operation is in progress, and 30 seconds have passed
                        

                        If I just exit single-user mode then when restart and /sbin/tunefs -t enable / it indicates it is disabled.

                        FYI - already added ahci_load="YES" to /boot/load.conf.local

                        1 Reply Last reply Reply Quote 0
                        • 3 Offline
                          3vian
                          last edited by

                          Seems you have to use /sbin/reboot as mentioned below to reboot

                          FYI - it should /sbin/tunefs -t enable /, not /sbin/tunefs -t / as mentioned below.

                          @spid:

                          @dstephens80:

                          Charlie,

                          I will give v2.2 a try and let you know how it goes.  As far as dmesg, I can provide nothing as the system will not boot with AHCI enabled.  it will not detect any GEOM devices, but it will boot fine if I remove the ahci_load="YES" from /boot/loader.conf.local.

                          Did you convert fstab to ufslabel before adding ahci_load="YES" ?

                          Run the following script to do it:
                          /usr/local/sbin/ufslabels.sh

                          then if it boots correctly go in single user mode and enable TRIM with:
                          /sbin/tunefs -t /

                          reboot with:
                          /sbin/reboot

                          and after a reboot check if it's enabled with:
                          tunefs -p /

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