ZFS zfs+geli+trim for ssd

maurizio

New Member


Messages: 15

Hello world!,

I installed my first FreeBSD on ZFS with geli encryption and I love it!
Code:
$ uname -a
FreeBSD freebsd.localhost 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  amd64
on https://www.freebsd.org/doc/en/books/faq/all-about-zfs.html#idp48940408 I read:
Note: ZFS TRIM may not work with all configurations, such as a ZFS filesystem on a GELI-backed device.
and on my /etc/sysctl.conf I don't find "vfs.zfs.trim.enabled=0"
Is it really impossible to enable trim on zfs+geli for my ssd? or the doc is not updated. If yes, how can I enable it?

Thank you very much for your support!
 
OP
OP
maurizio

maurizio

New Member


Messages: 15

on https://wiki.freebsd.org/NewFAQs I read:
Code:
9.28 I have heard about TRIM for Solid State Drives (SSD), is it supported by FreeBSD?

The TRIM filesystem flag is very useful for devices that use flash-memory (SSD for instance) and support the BIO_DELETE command. This flag is not enabled by default and can be enabled/disabled with tunefs -t enable | disable For more information see man 8 tunefs

    -t enable | disable
        Turn on/off the TRIM enable flag. If enabled, and if the under- lying device supports the BIO_DELETE command, the file system will send a delete request to the underlying device for each freed block. The trim enable flag is typically set when the underlying device uses flash-memory as the device can use the delete command to pre-zero or at least avoid copying blocks that have been deleted.

Important when using tunefs:

    This utility does not work on active file systems. To change the root file system, the system must be rebooted after the file system is tuned.

FIlesystems have to be mounted read-only or not mounted at all
but it seems tunefs works only with UFS file system. on https://www.freebsd.org/cgi/man.cgi?query=tunefs&sektion=8 I read:
Code:
The tunefs    utility    is designed to change the dynamic parameters of    a UFS
     file system which affect the layout policies.  The    tunefs utility cannot
     be    run on an active file system.  To change an active file    system,    it
     must be downgraded    to read-only or    unmounted.
A more specific doc about trim on zfs+geli should be written! It is really an important feauture.
 
OP
OP
maurizio

maurizio

New Member


Messages: 15

my ssd supports trim:
Code:
$ sudo camcontrol identify ada2 | grep TRIM
Data Set Management (DSM/TRIM) yes
And it seems trim was enabled by default ON THE ZFS DISK, right?
Code:
$ sysctl vfs.zfs.trim
vfs.zfs.trim.max_interval: 1
vfs.zfs.trim.timeout: 30
vfs.zfs.trim.txg_delay: 32
vfs.zfs.trim.enabled: 1
$ sysctl -d kstat.zfs.misc.zio_trim
kstat.zfs.misc.zio_trim:
kstat.zfs.misc.zio_trim.failed: Number of TRIM requests that failed for reasons other than not supported
kstat.zfs.misc.zio_trim.unsupported: Number of TRIM requests that failed because TRIM is not supported
kstat.zfs.misc.zio_trim.success: Number of successful TRIM requests
kstat.zfs.misc.zio_trim.bytes: Number of bytes successfully TRIMmed
$ sysctl -a |grep _trim
kern.cam.nda.max_trim: 256
kstat.zfs.misc.zio_trim.failed: 0
kstat.zfs.misc.zio_trim.unsupported: 0
kstat.zfs.misc.zio_trim.success: 4744
kstat.zfs.misc.zio_trim.bytes: 221179904
 
Top