I'm setting up ZFS (through FreeNAS) with RAIDZ1 on a server with 4 x WD Red SATA HDDs (connected through a PERC H330 in HBA mode).

The server is hooked to a UPS.

For ZFS and in this setup, does it make sense to enable HD cache of each disk, or is this very dangerous despite the UPS?


You should definitely enable the disk cache.

The rationale is that ZFS assumes enabled disk cache and so flushes any critical writes (ie: sync write and uberblock rewrite) via appropriate and specific SATA/SAS commands (ATA FLUSH, FUAs, etc).

Leaving the disk cache enabled permits to capitalize on the write-combining capability of modern disks without impact on pool reliability.

This obviously assumes that your disks actually honor the cache flush command, which is the norm for modern (post-2006) disks. In the rare cache your disks lie about cache flushing, then you should disable it.

As additional information, I suggest you reading the zfs_nocacheflush tunable description:

ZFS uses barriers (volatile cache flush commands) to ensure data is committed to permanent media by devices. This ensures consistent on-media state for devices where caches are volatile (eg HDDs).

| improve this answer | |

You can if you want. It won't make a big difference. ZFS leverages a portion of RAM for write cache and flushes to disk periodically.

With 4 disks, this sounds like a small installation, so benchmark both and see if there's even a noticeable benefit first.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.