Why does ZFS not allow cache and log on the same drive?

Without partitioning my disks, is there a way for OpenZFS to cache and log on the same vdev? Is there a reason this isn’t a thing?

I have two 1TB Optane drives for L2 Arc cache and two 1TB Optane drives for log (ZIL or SLOG?) in ZFS through TrueNAS.

I’m underutilizing my log drives. They have very little data on them yet there’s 1TB available for write-logging. I wish I could just have part of it be decided to log and the rest for cache.

If I manually partition, I could probably get both cache and logging vdevs on the same drives, but I’m afraid of breaking integration with TrueNAS and causing other issues by doing it manually in the CLI.

ZFS wants whole devices ideally. You can provide partitions instead but it generally isn’t recommended.

Regarding the SLOG, it’s not specifically a write log for caching. Without a specific Log device, synchronous writes are written immediately to the data vdevs along with RAM. With a Log device, they are instead written to said device along with RAM. It’s then written to the data vdevs roughly every 5 seconds and is therefore less random and more continuous. It’s only affects synchronous writes and doesn’t necessarily increase write speed either, it is more of data protection mechanism that just so happens to sometimes increase performance in specific scenarios. Without knowing your workload, I can’t really recommend anything.

My use case:
Samba for file storage as well as automated backups. I haven’t really used my NAS for much, but I installed Plex recently for family videos. I also added Resilio-Sync but might not keep it. I also do ZFS replication to an offsite NAS.

An alternative might be to use the two Optane drives for special vdev and set the specific tuning varable to store data blocks under a specific size on the special vdev as well. If you use raidz on data vdevs I don’t think you can remove the SLOG though.

Samba will use sync writes if sync always = yes, or if the client requests it and strict sync = yes.

strict sync = yes is the default in 4.7 and later.

That it is, my mistake

1 Like