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

    2.2-BETA trim support?

    Scheduled Pinned Locked Moved 2.2 Snapshot Feedback and Problems - RETIRED
    20 Posts 9 Posters 7.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.
    • K
      kejianshi
      last edited by

      I do believe that setting TRIM on pfsense is simple.  Its also simple on Linux.

      I'm just of the opinion by this point the OS should be handling it transparent to the user.

      Via SSH these guys are doing it this way (2.1):
      (copied and pasted - haven't tried on 2.2)

      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)

      All done I guess

      The thread is here…

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

      1 Reply Last reply Reply Quote 0
      • R
        router_wang
        last edited by

        This is ok to do on 2.2 ?

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

          I would think.

          Haven't tried.

          1 Reply Last reply Reply Quote 0
          • W
            Wolf666
            last edited by

            I am running 2.2 and I followed the steps suggested in my previous post. My Intel SSD S3500 has Trim enabled.

            Modem Draytek Vigor 130
            pfSense 2.4 Supermicro A1SRi-2558 - 8GB ECC RAM - Intel S3500 SSD 80GB - M350 Case
            Switch Cisco SG350-10
            AP Netgear R7000 (Stock FW)
            HTPC Intel NUC5i3RYH
            NAS Synology DS1515+
            NAS Synology DS213+

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

              @router_wang:

              This is ok to do on 2.2 ?

              Works for me.  For local machines you need console access as noted above.  For remote machines you have to re-apply the ugly but perfectly functional few lines of code that were removed earlier.

              1 Reply Last reply Reply Quote 0
              • R
                router_wang
                last edited by

                @Wolf666:

                I am running 2.2 and I followed the steps suggested in my previous post. My Intel SSD S3500 has Trim enabled.

                If I was running one of the data center drives, I wouldn't bother with trim.  Your S3500 doesn't need it.

                1 Reply Last reply Reply Quote 0
                • F
                  firewalluser
                  last edited by

                  I'm bumping this because I cant see to get trim to work despite following various threads.

                  camcontrol identify ada0
                  pass0: <ts2-e63 128g="" 2.54="">ATA-8 SATA 3.x device
                  pass0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)

                  protocol              ATA/ATAPI-8 SATA 3.x
                  device model          TS2-E63 128G
                  firmware revision    2.54
                  serial number        probably sensible to remove it
                  WWN                  5000000aadf41021
                  cylinders            16383
                  heads                16
                  sectors/track        63
                  sector size          logical 512, physical 512, offset 0
                  LBA supported        250069680 sectors
                  LBA48 supported      250069680 sectors
                  PIO supported        PIO4
                  DMA supported        WDMA2 UDMA6
                  media RPM            non-rotating

                  Feature                      Support  Enabled  Value          Vendor
                  read ahead                    yes yes
                  write cache                    yes yes
                  flush cache                    yes yes
                  overlap                        no
                  Tagged Command Queuing (TCQ)  no no
                  Native Command Queuing (NCQ)  yes 32 tags
                  NCQ Queue Management          no
                  NCQ Streaming                  no
                  Receive & Send FPDMA Queued    no
                  SMART                          yes yes
                  microcode download            yes yes
                  security                      yes no
                  power management              yes yes
                  advanced power management      yes no 254/0xFE
                  automatic acoustic management  no no
                  media status notification      no no
                  power-up in Standby            yes no
                  write-read-verify              yes no 0/0x0
                  unload                        yes yes
                  general purpose logging        yes yes
                  free-fall                      no no
                  Data Set Management (DSM/TRIM) yes
                  DSM - max 512byte blocks      yes              1
                  DSM - deterministic read      yes              any value
                  Host Protected Area (HPA)      yes      no      250069680/250069680
                  HPA - Security                no

                  tunefs -p /
                  tunefs: POSIX.1e ACLs: (-a)                                disabled
                  tunefs: NFSv4 ACLs: (-N)                                  disabled
                  tunefs: MAC multilabel: (-l)                              disabled
                  tunefs: soft updates: (-n)                                disabled
                  tunefs: soft update journaling: (-j)                      disabled
                  tunefs: gjournal: (-J)                                    disabled
                  tunefs: trim: (-t)                                        disabled
                  tunefs: maximum blocks per file in a cylinder group: (-e)  4096
                  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: space to hold for metadata blocks: (-k)            6408
                  tunefs: optimization preference: (-o)                      time
                  tunefs: volume label: (-L)

                  Trim_set doesnt work  (diagnostics, command prompt, execute shell command touch /root/TRIM_set; /etc/rc.reboot)  and when I use Diagnostics, Edit file, I cant see the file in question. Is it included in 2.2?

                  I've also tried dropping to single user mode, but no command is recognised when I get the # prompt up.

                  Plus other online sources appear to contradict some of the info given out on the forum, like this http://www.wonkity.com/~wblock/docs/html/ssd.html

                  I appreciate some of the info given out in the threads relate to freebsd 8.x but having tried a variety of combinations, I'm still unable to get trim enabled.

                  But as JohnPoz had just posted a thread link https://forum.pfsense.org/index.php?topic=85548.msg469374#msg469374 which I've tried with no success, I'm wondering if there are some missing steps or changes I'm unaware of due to now being on freebsd 10.x or a change in pf2.2?

                  So any suggestions?

                  TIA

                  Edit.

                  Having read this message https://forum.pfsense.org/index.php?topic=47650.msg251246#msg251246
                  about adding a trim enable option during installation, I couldnt see anything on Redmine, does anyone know if it ever got raised in the end?

                  Edit2.

                  Although I downloaded pfSense-memstick-2.2-RC-amd64-20141220-0119.img.gz  its showing Dec 14 on the dashboard.
                  2.2-RC (amd64)
                  built on Sun Dec 14 23:10:13 CST 2014
                  FreeBSD 10.1-RELEASE-p1</ts2-e63>

                  Capitalism, currently The World's best Entertainment Control System and YOU cant buy it! But you can buy this, or some of this or some of these

                  Asch Conformity, mainly the blind leading the blind.

                  1 Reply Last reply Reply Quote 0
                  • B
                    binaryjay
                    last edited by

                    Anybody have any clue how trim behaves in FreeBSD 10+ inside of a hyper-v environment VHDX?

                    1 Reply Last reply Reply Quote 0
                    • F
                      firewalluser
                      last edited by

                      Did you post the same question to here http://help.howproblemsolution.com/1027145/2-2-beta-trim-support or was it likely scraped from this forum?

                      Capitalism, currently The World's best Entertainment Control System and YOU cant buy it! But you can buy this, or some of this or some of these

                      Asch Conformity, mainly the blind leading the blind.

                      1 Reply Last reply Reply Quote 0
                      • H
                        heper
                        last edited by

                        why would you want to enable trim inside a VM? i would think the host-os should handle it.

                        1 Reply Last reply Reply Quote 0
                        • F
                          firewalluser
                          last edited by

                          Might be useful.
                          http://msdn.microsoft.com/en-us/library/hh848053%28v=vs.85%29.aspx
                          "New API allows apps to send "TRIM and Unmap" hints to storage media"
                          "What is TRIM?

                          Solid state drives (SSDs) are typically flash memory based block-erased devices; this means that when data is written to the SSD, it cannot be over-written in place and must be written elsewhere until the block can be garbage collected. Since the SSD has no internal mechanism for determining that certain blocks are removed and others are needed. The only time the SSD can mark a sector ‘dirty’ is when it is over-written. In other cases, such as when a file is deleted, the SSD retains these sectors because the deletion is performed as a master file table (MFT) change only, and not as an operation to all the sectors of the file. In Windows 7, we introduced a standard way of communicating with SSDs about sectors that are not needed any more. This command is defined in the T13 specification as the TRIM command; NTFS sends the TRIM command for some normal inline operations such as “deletefile.”

                          Other uses of TRIM in the storage world

                          Like SSDs, storage area networks (SANs) and the new Windows 8 feature Software Spaces implementations consume TRIM command hints to manage their spaces in thinly provisioned environments. SANs and Software Spaces allocate regions of storage in sizes that are greater than sectors or clusters (anywhere from 1MB to 1GB). When they receive TRIM hints for its allocation size (or greater than the allocation size), the SAN/SSD can de-allocate a region to free up the space for other files. They typically pass through all TRIM hints to the underlying media (SSD or HDD) so that they can consume the freed up space as appropriate. They do not typically move data around to de-allocate regions, nor do they keep track of TRIM areas to de-allocated regions (when the region is empty).

                          Thinly provisioned SANs use the TRIM hints that are passed to them to help reduce the overall physical storage footprint, hence reducing cost. The T10 SCSI specification defines the ‘Unmap’ command (similar to the TRIM command); here the command is applicable to all kinds of storage including HDDs, SSDs, and others. The UnMap command helps to remove physical blocks from the SAN’s allocation. "

                          Obtained from here.

                          http://workinghardinit.wordpress.com/2012/05/23/trimunmap-support-in-windows-server-2012-hyper-vvhdx/

                          Edit.

                          Seems some bugs existed in the VHDX as well.
                          https://social.msdn.microsoft.com/forums/windowsapps/en-us/e5a1ff92-f584-42aa-bdbc-7db52e278035/feedback-on-the-vhdx-specification

                          A comment seen here http://xen-api.narkive.com/bwPFiNPv/vhdx-support

                          "The biggest issue with implementing VHDX is that we don't know of any
                          existing, open-source implementation of it, which means that we would
                          have to invest a lot of time to write our own from scratch. If anyone
                          knows of any existing VHDX implementations that we can use, I'm sure the
                          storage team would like to hear about it!"

                          But further down it looks like what support exists is just read only, but you might interpret this differently to me.
                          "http://wiki.qemu.org/ChangeLog/1.5#Block_devices

                          • VHDX (MS Hyper-V) image format has initial read-only support.
                            Dynamic and fixed sized disks are supported, but not differencing
                            images (e.g. VHDX images with a backing file). Read-only is strictly
                            enforced, and the 'readonly=on' option must be used for any VHDX images."

                          So I'd say based on the limited info and the dates ie July 2013, not much in the opensource world will support MS VHDX but I could be wrong based on my google results, plus its also worth bearing in mind the popular results google presents are the most popular and not always the correct answer, as I have seen with some virus/malware affecting forums, and the subsequent top results in google which is actually helping to spread the problem.

                          Capitalism, currently The World's best Entertainment Control System and YOU cant buy it! But you can buy this, or some of this or some of these

                          Asch Conformity, mainly the blind leading the blind.

                          1 Reply Last reply Reply Quote 0
                          • B
                            binaryjay
                            last edited by

                            @heper:

                            why would you want to enable trim inside a VM? i would think the host-os should handle it.

                            Well the host is just aware of the vhdx file, it probably trims when you compact the virtual disk but without guest support making the host aware no sectors in the file are ever 'deleted' prior too that point.

                            That being said pfsense has a small size compared to most ssd and I think it would have a hard time causing issues even without trim.  Maybe it's a good idea to perform a compact once in a while assuming you're using thin provisioning which is the default.

                            I'm sure windows 8/server 2012 guests properly trim in the host but I can't find any information about freebsd guest services trim support.  I know it doesn't support dynamic memory yet which is a shame considering Linux has a pretty complete guest services implementation already.

                            1 Reply Last reply Reply Quote 0
                            • B
                              Bronko
                              last edited by

                              only these final step worked for me:

                              You may try this instead in single user mode:
                              
                              /sbin/tunefs -t enable /
                              
                              After that reboot and then run tunefs -p /
                              
                              The touch /root/TRIM_set; /etc/rc.reboot has been removed in the newer version.
                              

                              from: https://forum.pfsense.org/index.php?topic=66622.msg430150#msg430150

                              1 Reply Last reply Reply Quote 0
                              • W
                                wbedard
                                last edited by

                                @firewalluser:

                                I'm bumping this because I cant see to get trim to work despite following various threads.
                                …
                                I've also tried dropping to single user mode, but no command is recognised when I get the # prompt up.
                                ...

                                I just went down the same "rabbit-hole" as you but I finally succeeded.  When you get to the single-user prompt, you won't have a path set that can find the "tunefs" command.  Simply use the full path and proceed as documented (/sbin/tunefs -t enable /).  After that command, I did get an error when I tried to reboot saying something about the filesystem being read-only.  After a Ctrl-Alt-Del though, the system did perform an orderly shutdown/reboot.  Once the system had started back up, I confirmed that my filesystem did have trim support enabled.

                                Try this out and be sure to let us know how it goes for you.

                                R/
                                wbedard

                                1 Reply Last reply Reply Quote 0
                                • F
                                  firewalluser
                                  last edited by

                                  /sbin/tunefs -t enable /

                                  and

                                  from: https://forum.pfsense.org/index.php?topic=66622.msg430150#msg430150

                                  I'm fairly sure I tried that as well as this was one of the many threads I'd read yesterday but I'll give it another go tomorrow, just to be sure.

                                  Edit.
                                  Got it to work, where I believe I went wrong before was using /bin/sh instead of /sbin/.

                                  Thanks for your help.

                                  Capitalism, currently The World's best Entertainment Control System and YOU cant buy it! But you can buy this, or some of this or some of these

                                  Asch Conformity, mainly the blind leading the blind.

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