pfSense Gold Subscription

Author Topic: 2.3 RC Trim and alignment?  (Read 5816 times)

0 Members and 1 Guest are viewing this topic.

Offline Koenig

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +1/-0
    • View Profile
2.3 RC Trim and alignment?
« on: April 06, 2016, 03:49:26 pm »
Got me some new hardware to replace my old pfsense machine:
5257U
16GB RAM
250GB Samsung 850 EVO

Me beeing very new to pfsense (had help with my old installation + it has "grown" over the years) I have a lot of questions.

To start with I'm wondering if the installer from the memstick image aligns the partitions and enables trim if you have a SSD?

Offline Keyser Soze

  • Newbie
  • *
  • Posts: 20
  • Karma: +5/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #1 on: April 06, 2016, 06:58:22 pm »

I don't have that hardware, but FWIW, I had to manually enable trim on my Samsung SSD.

You can check to see if trim is already enabled by doing:

Code: [Select]
tunefs -p /

If trim is on, one of the lines of output will show enabled as below:

Code: [Select]
tunefs: trim: (-t)                   enabled


If it's not enabled, you have to manually enable it once while running in single user mode. I used the following tutorial to set mine.

https://gist.github.com/mdouchement/853fbd4185743689f58c

Offline Koenig

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +1/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #2 on: April 07, 2016, 01:48:17 am »

I don't have that hardware, but FWIW, I had to manually enable trim on my Samsung SSD.

You can check to see if trim is already enabled by doing:

Code: [Select]
tunefs -p /

If trim is on, one of the lines of output will show enabled as below:

Code: [Select]
tunefs: trim: (-t)                   enabled


If it's not enabled, you have to manually enable it once while running in single user mode. I used the following tutorial to set mine.

https://gist.github.com/mdouchement/853fbd4185743689f58c

So I followed the instructions from the link but when verifying that TRIM really was enabled I get this:

On command: "tunefs -p /" I get "tunefs: trim: (-t)                                         enabled"
But with : "tunefs -p /var" I get "tunefs: trim: (-t)                                         disabled"

EDIT: Just realized why I got different results, I have enabled "/var" as RAM-disk in the WEB-GUI

Then there's the question of partition alignment, does the installer do it properly?
« Last Edit: April 07, 2016, 01:55:43 am by Koenig »

Offline betatest

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #3 on: April 07, 2016, 08:00:21 am »
Do not enable TRIM on Samsung SSDs!

I am serious! They have a very strange TRIM bug under Linux based machines!
It will destroy all your data. I had one in a QNAP NAS.

After a lot of configuration and setting up VMs on that QNAP, TRIM did not start instantly but after some days and destroyed everything  >:(

And do not make the same mistake as me and think that will not happen to the PRO series. It also happens to them. Have fun explaining that bug to your reseller  :P
Buy a intel SSD and you can save a lot of headache! They are not that much more expensive anymore and way more reliable.
« Last Edit: April 07, 2016, 08:04:26 am by betatest »

Offline Koenig

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +1/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #4 on: April 07, 2016, 08:08:20 am »
Do not enable TRIM on Samsung SSDs!

I am serious! They have a very strange TRIM bug under Linux based machines!
It will destroy all your data. I had one in a QNAP NAS.

After a lot of configuration and setting up VMs on that QNAP, TRIM did not start instantly but after some days and destroyed everything  >:(

And do not make the same mistake as me and think that will not happen to the PRO series. It also happens to them. Have fun explaining that bug to your reseller  :P
Buy a intel SSD and you can save a lot of headache! They are not that much more expensive anymore and way more reliable.

Perhaps related to this: https://linux.slashdot.org/story/15/07/30/1814200/samsung-finds-fixes-bug-in-linux-trim-code

It should be fixed now anyway.

Offline betatest

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #5 on: April 07, 2016, 08:16:26 am »
I read that too but it is still not fixed. And it is not fixed in the newest firmware (Dez. 2015).
I don't know if Samsung or Linux ist to blame (I think Samsung, they denied it for a long time and said it's Linux fault).
Sure if it is a just for fun project I would not care. But if you use it productive just get a new one. SSDs are so cheap nowadays.

Offline heper

  • Hero Member
  • *****
  • Posts: 2690
  • Karma: +253/-11
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #6 on: April 07, 2016, 08:19:53 am »
does this apply to freebsd? pfsense does not run on linux

Offline Koenig

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +1/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #7 on: April 07, 2016, 08:27:20 am »
I read that too but it is still not fixed. And it is not fixed in the newest firmware (Dez. 2015).
I don't know if Samsung or Linux ist to blame (I think Samsung, they denied it for a long time and said it's Linux fault).
Sure if it is a just for fun project I would not care. But if you use it productive just get a new one. SSDs are so cheap nowadays.

Here's a little more on the matter and not just a random forum post: https://blog.algolia.com/when-solid-state-drives-are-not-that-solid/

My setup is not supposed to be "just for fun" but it is not that super-sensitive either we can do with a little downtime.

Where do you get that is in the drives itself, and is not fixed yet?


Offline betatest

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #8 on: April 07, 2016, 08:47:12 am »
Quote
Where do you get that is in the drives itself, and is not fixed yet?

My own experience  ;D I did this setup 2 months ago. I have read, that it is not that important to have TRIM enabled (OSX didn't have TRIM for a long time on 3 party SSDs).
In my opinion you would be better of by not having TRIM enabled than having it enabled on a Samsung SSD.

Quote
FreeBSD is a free Unix-like operating system descended from Research Unix via the Berkeley Software Distribution (BSD).
So it is kind of a Linux? Or maybe has the same implementation of TRIM than Linux?

I don't now where you live but in my country you can get a Intel SSD for 50$ (120GB) or you get a Intel Datacenter SSD (80GB) for 80$. Think about how much you earn an hour and how much time it will cost you to restore a dead SSD...

You can still use our Samsung SSD for Squid or something else  :D

Offline Koenig

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +1/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #9 on: April 07, 2016, 09:09:07 am »
Quote
Where do you get that is in the drives itself, and is not fixed yet?

My own experience  ;D I did this setup 2 months ago. I have read, that it is not that important to have TRIM enabled (OSX didn't have TRIM for a long time on 3 party SSDs).
In my opinion you would be better of by not having TRIM enabled than having it enabled on a Samsung SSD.

Quote
FreeBSD is a free Unix-like operating system descended from Research Unix via the Berkeley Software Distribution (BSD).
So it is kind of a Linux? Or maybe has the same implementation of TRIM than Linux?

I don't now where you live but in my country you can get a Intel SSD for 50$ (120GB) or you get a Intel Datacenter SSD (80GB) for 80$. Think about how much you earn an hour and how much time it will cost you to restore a dead SSD...

You can still use our Samsung SSD for Squid or something else  :D

Maybe I'll spring for an Intel drive eventually (limited options with mSATA), this is what I got today so I'm gonna work with it for now.
Once everything is setup the way I want it I will make a backup image of the drive anyway (using Redo) so it's going to be a rather easy migration to a new drive anyway.

There's still the question if the installer aligns the partitions correct?


Another thing - ZNC is ported to FreeBSD is there an "easy" way to install it on pfSense?

Offline serialdie

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +8/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #10 on: April 07, 2016, 11:00:17 am »

Quote
FreeBSD is a free Unix-like operating system descended from Research Unix via the Berkeley Software Distribution (BSD).
So it is kind of a Linux? Or maybe has the same implementation of TRIM than Linux?

So many No's in one sentence I wont be able to fit them....

UNIX is not Linux and Linux is not UNIX. For the most part UNIX does not use the same implementations of any of the linux binary's.

Offline Keyser Soze

  • Newbie
  • *
  • Posts: 20
  • Karma: +5/-0
    • View Profile
Re: 2.3 RC Trim and alignment?
« Reply #11 on: April 07, 2016, 12:07:29 pm »
FWIW, I have been using Samsung SSDs with TRIM enabled (mSata drives specifically) with Centos and Debian Linux for 3+ years on high-use production equipment with no problems. If I remember correctly, there was a specific firmware version that potentially corrupted Sammy drives when TRIM was enabled under Linux and specific kernels, I was never bitten by this, but know others who were.

If you are not writing and deleting a bunch of data on the drive over and over enabling TRIM is an arguable benefit, and in my specific use case for pfSense, it is only my OCD that makes me enable it, I use a ram disk and offload all the logging to a remote syslog server which keeps the amount of disk writes/rewrites to a minimum.


And no... BSD is not Linux.
« Last Edit: April 07, 2016, 12:14:43 pm by Keyser Soze »