Do you TRIM a tiered/cached storage solution?

That’s what I wonder after setting up logical volumes with LVM where the original files are backed by an HDD raid1 and cached on SSD in writeback-mode.
The data always hits the fast storage first, then trickles down to the slow one sequentially.

But what happens to the SSD in regards to TRIM/discard? Is this transparently forwarded to the underlying hardware? Is it actually working? How do you verify it does?

With my limited understanding of this, I can tell that issuing fstrim -v <mount> is returning confirmation that zero-blocks are being discarded, however the size in GB reflects that of the LV on HDD rather than SSD, so I kinda doubt it’s executing TRIM correctly. Unfortunately, this is all clues I have.

So for zfs, as an example, the ssd needs to be trimmed, and if you’re using it for vms, those virtual disks (zvols) need to be trimmed, but zfs will handle trimming the individual disks. Or should. Zfs on bsd will trim your ssd, but not on Linux, yet.

Create a small partition on the SSD that is not used for anything and use blkdiscard on it.

That’s interesting. In fact the cache LVs can be addressed via device mapper like this:

/dev/mapper/vgTest-lvmd0
/dev/mapper/vgTest-lvmd0_cachepool_cdata
/dev/mapper/vgTest-lvmd0_cachepool_cmeta
/dev/mapper/vgTest-lvmd0_corig

These react to blkdiscard. I will go ahead and try finding out whether this works or not by observing.

Yeah… I’ve been waiting for this to hit the release date for quite a while. Unfortunately, the issues are beginning to pile up at the moment, looking at the recent code regressions and now incompatibility with kernel 5.0 due to some licensing shenanigans. I love ZFS but ultimately it made me switch to something “mainline”.

1 Like

Zfs has always been license incompatible.

This is why I use btrfs on my desktops.

3 Likes

True. However, this time they don’t seem to get past this issue without building another GPL “condom” around it. That’s how others are caling it. :smiley:

1 Like

I have no idea what you’re talking about. ZFS and SPL have always been incompatible, which is why they’re not shipped with the OS, except for in Ubuntu/Proxmox’ case. Ubuntu and Proxmox are violating the GPL.

That’s not a condom, it’s just you violating the GPL by building it.

Bottom line is that Kernel 5.0 will stop exporting certain symbols ZoL is depending on in order to vectorize checksumming.

More about that, here.

1 Like

I think it would be really unfortunate if ZoL were felled by hostility to the fact that it is not GPL. I’ve only been using it for a short time, but I’ll be annoyed if it gets passive-aggressively broken.
Worries about lack of TRIM (as well as possible license issues) made me think about going with freeBSD/Bhyve instead of KVM on Linux. But sadly my attempts at installing freeBSD were utter failure, so I never got to try out Bhyve.

1 Like