2.2 trim



  • I found this https://forum.pfsense.org/index.php?topic=83272.msg456248#msg456248 I just wanted to make sure this information is still the correct way of enabling trim.

    Is there anything I need to worry about with adding ahci_load="YES" to the /boot/loader.conf.local ? I know with Windows, it hates having the boot storage system change. Is there a reason why ahci isn't used as default for systems that have it?

    Thanks!

    P.S. I'm using gmirror



  • I installed 2.2 to a new SSD and noticed that trim was not enabled by default.  If you do an upgrade it may keep the settings, I'm not sure.

    I noticed after installing 2.2 that ACHI was already enabled, unlike in 2.1.5, so you can probably skip that step for 2.2.  To enable trim I used the tunefs command in single user mode and confirmed it was enabled after rebooting.  These steps are outlined in the later messages in the thread you posted the link to.  I didn't bother with touching /root/TRIM_set since later messages seem to indicate that it's obsolete.

    If you do have to enable achi mode use the ufslabels.sh script as outlined in that same thread before rebooting, otherwise your system may not boot correctly as you noted.



  • I have never seen one single post of an industrial SLC crashing in a pfsense and thats with no TRIM.

    But if you do have MLC SSD, TRIM is definitely required.



  • Because I did an upgrade from 2.1.5 I had this in /boot/loader.conf.local
    ahci_load="YES"

    Running kldstat shows no sign of ahci.

    Does this mean ahci is compiled into the kernel?
    Does this mean I can simply remove ahci_load="YES" from /boot/loader.conf.local without any problems?



  • @kejianshi:

    I have never seen one single post of an industrial SLC crashing in a pfsense and thats with no TRIM.

    But if you do have MLC SSD, TRIM is definitely required.

    Modern Samsung SSDs will even wear level static data. So even if your drive is full up and you make changes to only one block, over and over, it will still make sure the drive gets wear leveled. Trim helps a lot, but it's not as important as it used to be.



  • @mir:

    Running kldstat shows no sign of ahci.

    Does this mean ahci is compiled into the kernel?
    Does this mean I can simply remove ahci_load="YES" from /boot/loader.conf.local without any problems?

    Yes.  Check for built-ins like so: "kldstat -v | grep ahci".  Without the "-v", kldstat returns only external modules.

    I didn't bother with touching /root/TRIM_set since later messages seem to indicate that it's obsolete.

    Yes, that's obsolete with 2.2 and the code that dealt with that has been removed.  You now have to follow the manual methods (single user mode detailed in many threads) to enable TRIM.



  • I am new to pfSense and just put my system together.  I will be the first to admit that that I know nothing about FreeBSD or Linux for that matter.  I have to follow either product documentation or others examples.  As part of my system, I reused a Samsung 840 Pro 256 SSD I had.  Obviously I wanted to enable trim.

    I found this thread and another, https://forum.pfsense.org/index.php?topic=83272.15, documenting it.  Below is the consolidated steps I had to follow.  This is posted for others that might find it helpful.  Note the quotes "" surrounding the commands is not required as part of the command.  They are here merely to distinguish the command text.

    Login with SSH and open the shell.
    

    EDIT: Per Sn3ak below this is not required with 2.2
    Run “/usr/local/sbin/ufslabels.sh” Note, not really sure this is required.

    /usr/local/sbin/ufslabels.sh
    

    Not really sure this is required as my bios is set to AHCI and has been running fine for ~ two weeks now.  But I followed kejianshi example.  I used the built in editor as I am not really sure how to use the command line version.

    EDIT: Per Sn3ak below this is not required with 2.2

    Use the Diagnostics > Edit File command to create and add the line ahci_load="YES" to “/boot/loader.conf.local”
    

    At the boot prompt, select option 2 to select single user mode.

    Reboot the machine and restart in single user mode.
    

    Note: my system has a SD card reader in it.  The system would not boot without a SD card plug into it.  After it started booting I inserted a SD card where it had media. It would not boot with the media in the reader.  I had to insert the media during the boot process.  It boots just fine during a normal boot.  I will be removing this item.

    At the # prompt in your terminal issue “/sbin/tunefs -t enable /”  The end slash is required.  Note: I could not SSH into my system, I had to use the locally connected monitor and keyboard.

    /sbin/tunefs -t enable /
    

    Reboot the system with “/etc/rc.reboot”.

    /etc/rc.reboot
    

    EDIT: Note: I had to reboot with “/etc/rc .reboot”, Note the space in front of the period.  This appears to reboot in single user mode.  I had to wait over 30 seconds to issue the command according to the prompt.  After the reboot, I could reboot with the following “/etc/rc.reboot”.

    Once the machine has rebooted

    Login with SSH and open the shell
    

    Check the status with the following command:

    tunefs -p /
    

    [2.2-RELEASE][admin@pfSense.xxx]/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)
    [2.2-RELEASE][admin@pfSense.xxx]/root:

    A also agree with another poster, SSDs are so common place today, this should be an option either set at install or as a menu choice within pfSense.  Just like I am pretty sure my drive is not 4K aligned which I believe should be an option or better yet the default as part of the install process.



  • It sure would help new folks and non-technical types if there was a "SSD or HD" prompt at install and the settings were tweaked to meet what the user had. If not that a section in the FAQ on getting the settings right following the initial install would be a big help.



  • Seems like such a no-brainer feature to add right?  (For all OSes!)

    Not sure of the technical complexity of adding it though.



  • @switchman:

    A also agree with another poster, SSDs are so common place today, this should be an option either set at install or as a menu choice within pfSense.  Just like I am pretty sure my drive is not 4K aligned which I believe should be an option or better yet the default as part of the install process.

    I'm not sure if PFSense 4KB aligns, but I know a lot of Operation Systems default to 1MB alignment or even larger.



  • @switchman:

    Login with SSH and open the shell.
    

    Run “/usr/local/sbin/ufslabels.sh”  - It's required for older installs, or installs that have been upgraded to 2.2. It shouldn't be needed for a fresh 2.2 install

    /usr/local/sbin/ufslabels.sh
    

    This isn't required. ahci is compiled into the kernel. It's probably better to remove that entry (though it shouldn't hurt anything)

    Use the Diagnostics > Edit File command to create and add the line ahci_load="YES" to “/boot/loader.conf.local”
    

    Some notes changed/added inline.