2.2 install, Trim and Single User Mode

  • Sorry to bring up the Trim topic again, but after I had to rebuild a Netgate C2758 with 2.2 because the upgrade from 2.1.5 failed, I noticed that Trim was not enabled, so I found this thread on the forums:


    As suggested there, I added ahci_load="YES" to /boot/loader.conf.local , but when I tried to reboot in single user mode to run the /sbin/tunefs -t enable /, the boot process stops at:

    Trying to mount root from ufs:/dev/ada0s1a [rw]…

    I tested this on a brand new Netgate C2758 that shipped with 2.2 preinstalled and I also cannot boot in Single User.

    Both are booting fine in Multi User mode, but then I cannot run the /sbin/tunefs -t enable / because I get a failed to write superblock error. Any other way to enable Trim or at least boot in Single User?

  • Anybody?

  • AFAIK, AHCI is built into the 2.2 images and later 2.1.x images, so you should not need to modify the boot flags to load the kernel module.  Indeed, the ahci.ko file is not present on my 2.2 system, it's built in.

    The units from Netgate do not use the standard pfSense images, they are tweaked by Netgate, so they should be your first stop for answers.  That said, you certainly should be able to use single-user mode.

    Since the previous method of enabling trim (some would say hack) was removed, you need to get to single user mode to enable trim as there's no equivalent replacement yet.

  • Thank you for the reply. The first Netgate C2758 was rebuilt last Saturday with the official 2.2 Release full install and is the one where I'm trying to enable Trim. The second box arrived from Netgate 2 days ago with 2.2 already preinstalled and has Trim enabled.

    However on both cases I cannot boot in single user mode (option 2 on boot menu) with the boot stopping at:

    "Trying to mount root from ufs:/dev/ada0s1s [rw]"

    Whatever is preventing me from booting in Single User mode is not specific to whatever Netgate customization they use.

    On the second box that came from Netgate with 2.2 and is not in production yet, I was able to boot in single user mode by booting from a USB flash drive with the 2.2 full install image. I was then able to test disabling and enabling Trim on the SSD with the tunefs command. I will try this method on the production box which currently has Trim disabled.

    Tried the same procedure on the other box and it worked. I was able to boot in single user mode from USB and then enable Trim.

  • Just did a fresh install of 2.2 64-bit on a new pfsense box for my lab. It's installed on a 128GB Samsung 840 Pro SSD. I don't use squid or any disk write intensive plugins, and that SSD is supposed to be pretty rugged but I thought I'd enable trim just for my own peace of mind.

    I was able to get trim enabled by booting into single-user mode and issuing the commands as detailed in a post on another thread:

    /sbin/tunefs -t enable /

    …and then verified it after rebooting:

    [2.2-RELEASE][root@pfsense.<my domain="">.com]/root: 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)                                        enabled
    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)

    Many thanks to posters on the 2.1 SSD trim thread, and big kudos to Chris and the pfsense team. This is one solid product that I've used for many years without a single glitch and which I've recommended over and over.

    Hope this helps.</my>