FreeBSD 9.2 supports ZFS TRIM/UNMAP

By | April 15, 2014

Just playing around with this today, and it’s very cool. FreeBSD 9.2 now supports TRIM/UNMAP for ZFS.

To see if your disk is reporting the capability, look for kern.cam.da.<device>.delete_method where <device> is the number of the da device, i.e. /dev/da5 is “5” in that place.

For example:

# sysctl -a | grep delete_method
kern.cam.da.0.delete_method: NONE
kern.cam.da.1.delete_method: NONE
kern.cam.da.2.delete_method: NONE
kern.cam.da.3.delete_method: NONE
kern.cam.da.4.delete_method: NONE
kern.cam.da.5.delete_method: UNMAP
kern.cam.da.6.delete_method: NONE
kern.cam.da.7.delete_method: NONE
kern.cam.da.8.delete_method: NONE
kern.cam.da.9.delete_method: NONE
kern.cam.da.10.delete_method: NONE
kern.cam.da.11.delete_method: NONE
kern.cam.da.12.delete_method: NONE

I’ve tested this with a Pure Storage FlashArray, using FreeBSD 9.2 running under VMware, and an RDM LUN passed through to FreeBSD to give it native SCSI access. That’s da5 above showing the UNMAP method.

According to Alexander Motin, the following are supported and settable via sysctl:

  NONE - no provisioning support reported by the device;
  DISABLE - provisioning support was disabled because of errors;
  ZERO - use WRITE SAME (10) command to write zeroes;
  WS10 - use WRITE SAME (10) command with UNMAP bit set;
  WS16 - use WRITE SAME (16) command with UNMAP bit set;
  UNMAP - use UNMAP command.

 

Category: How-To Tags: , ,

About Bill Plein

I've been in the data storage industry since the 1990's, most recently with 3PAR, Fusion-io, and Pure Storage. I'm now with Diamanti, where we make Kubernetes easy and fast. I'm attracted to bright, shiny new objects.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.