Enable Trim on geom mirror
-
I'm a Linux guy, so I'm alittle uneasy making changes on FreeBSD without being sure.
ok, so my two recycled laptop drives I had running in my firewall both developed bad sectors… kinda was a pain. so I went to Microcenter and bought a couple of PNY 120GB SSD's. These suckers are TLC, so I really want to run trim, but I'm unsure as to how and don't want to screw anything up.
right now if I run tunefs -p / it shows trim is not running... but is that just on the mirror device? how do I see the physical drives?
I have them running in a mirror, most of the howto's I've found make mention of enabling AHCI in the loader.conf.local, that's easy. Next you are to reboot off of a USB and use tunefs on the device ID of the drive. Well, my fstab isn't using device id's of drives, it just shows pfSenseMirrors1a and pfSenseMirrors1b. Do I enable trim on that? (sounds wrong) or the ada0 and ada1?
anyway, if anyone that can provide me some direction I would appreciate it.
-
TRIM is a filesystem level thingy on FreeBSD, you enable or disable it on a UFS filesystem and not on the raw partitions that make up the GEOM mirror provider. It should work by booting into single user mode and running tunefs -t enable /dev/mirror/ <root>where <root>is the device node corresponding to the root filesystem. In your case <root>is /dev/mirror/pfSenseMirrors1a. The name may be confusing but the name of the GEOM mirror provider is pfSenseMirror, the virtual disk provided by it is split into slices and the first slice is s1 and finally the a at the end is for the first FreeBSD partition on the slice. Reboot when done</root></root></root>
-
I appreciate the response. I actually thought that maybe trim was enabled, just not propagating through gmirror… nope, gstat -d shows no biodeletes after alot of activity, so I don't think it's running but not showing in tunefs...
I went ahead and enabled AHCI and rebooted, then touched the file /root/TRIM_set and rebooting... no joy.
Next I booted off a usb into single user mode, but when I issued the command "tunefs -t enable /dev/mirror/pfSenseMirror1a" it tells me this:
tunefs: /dev/mirror/pfSenseMirror1a: could not find special deviceI'm not sure what to make of that. I checked, it does show up in the filesystem. I also tried it on 1b and 1 just for kicks, but got the same result. Not sure where to go from there, and googling around for freebsd similar issues isn't helping me either.
Any ideas?
-
you will need to create the geom mirror device in the rescue boot.
Sadly I rarely have used geom mirror so I dont know off hand how to do this, but am about to have a quick look at the documentation and if I find the answer it will be at the end of this post before I click submit.
For sure you will need to load the module which the command is```
kldload geom_mirrorTry that and report back if the geom device works or not.
-
It's possible that TRIM still doesn't work on geom_mirror. I tried to google for relevant information but it's pretty scarse except for a few FreeBSD mailing list posts from 2011 and 2012.
-
yeah now days zfs is the popular choice thats why.
UFS I think its days are numbered.
The pfsense installer does need modernisiing I feel, add zfs support, make partitions 4k aligned, and add GPT support, as well as enabling trim if a ssd is detected.
-
The pfsense installer does need modernisiing I feel, add zfs support, make partitions 4k aligned, and add GPT support, as well as enabling trim if a ssd is detected.
ZFS (incl. mirror) and GPT is already there in 2.4 snapshots. There won't be any trim support anywhere, but you can reboot to single user mode from the console menu.
-
ZFS supports TRIM natively so it'll do that automatically. There is a knob to disable it if your disk blows up with it on:
https://www.freebsd.org/doc/faq/all-about-zfs.html#idp59422952