Using a Solid State Drive with FreeBSD

wblock@

Developer
Using a Solid State Drive with FreeBSD shows how to set up SSDs on FreeBSD. This article is new and still being revised, but is now in a reasonable state to share with a larger group. Feedback welcome.

PS: credit for the idea of using a swap file to take advantage of TRIM is due to forum member throAU.

PPS: A reference to most SSDs including information about controller and memory types and links to external reviews: http://www.johnnylucky.org/data-storage/ssd-database.html
 
Thanks @wblock, I really appreciate your guides!

But there is something unclear to me in this passage:

Following the root partition is a 2G partition for /var and the rest of the SSD for /usr. Actually, a 1G /var is often large enough. These are aligned to 1M increments, again an even multiple of the 4K block size. Salt to taste.

# gpart add -t freebsd-ufs -l ssdvarfs -a 1m -s 2g ada0
# gpart add -t freebsd-ufs -l ssdusrfs -a 1m ada0
# gpart add -t freebsd-ufs -l ssdrootfs -b 1m -s 2g ada0

First, you add 2 partitions aligned (-a) to 1 M, then you add the root partition starting (-b) at the 1 M boundary.
I think I misunderstood the meanings of the -a and -b flags.
 
Last edited by a moderator:
I use SSD with FreeBSD just as any other regular drive, no special steps taken, as I have 8 GB RAM I did not even bother to enable swap.
 
Dies_Irae said:
Thanks @wblock, I really appreciate your guides!

But there is something unclear to me in this passage:



First, you add 2 partitions aligned (-a) to 1M, then you add the root partition starting (-b) at the 1M boundary.
I think I misunderstood the meanings of the -a and -b flags.

The example is definitely wrong because the last command would try to create partition over an existing partition, the -b flag means an absolute sector number for the starting sector.
 
Last edited by a moderator:
The order seems to be off, it probably should be something like this:
Code:
# gpart add -t freebsd-ufs -l ssdrootfs -b 1m -s 2g ada0 
# gpart add -t freebsd-ufs -l ssdvarfs -a 1m -s 2g ada0
# gpart add -t freebsd-ufs -l ssdusrfs -a 1m ada0

That would make the first the root file system, the second var and the rest for usr.
 
How can I check to see if I formatted my SSD with TRIM? I remember reading Warren's article but don't recall what I did. Is there any idea how much wear leveling helps increase longevity (I presume)? Is it worth reformatting my drive to do this?
 
The utility to use to check for TRIM is tunefs(8), for example:

Code:
firewall ~ # tunefs -p /dev/ada0p2
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 enabled
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: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 
firewall ~ #

As you can see TRIM is a filesystem level feature, not for the full disk.
 
Dies_Irae said:
Thanks @wblock, I really appreciate your guides!

Thanks!

First, you add 2 partitions aligned (-a) to 1 M, then you add the root partition starting (-b) at the 1 M boundary.
I think I misunderstood the meanings of the -a and -b flags.

The example got moved around, probably an editing error on my part. I'll fix it. @SirDice has the right order.

-a is for Align, and -b is for Begin.
 
Last edited by a moderator:
I can't categorically say it's 100% up-to-date, but the information in it is still relevant, especially and ABSOLUTELY, the part about using dd on SSDs.
A quick perusal makes me think there's nothing written then that doesn't apply now.

I am not sure there's any SSDs on the market now that don't support trim. If there are, as the author states, stay away from them.
It's also worth noting nowadays that consensus is to only partition 80% of the capacity, leaving around 20% free and never used.
 
Back
Top