[zfs-discuss] Should I disable disk write cache ?

Gordan Bobic gordan.bobic at gmail.com
Wed Sep 2 05:17:31 EDT 2015

That is an excellent question. The advice I have seen from people in the
know on this list regarding ZoL is that it is safe to enable disk write
cache as barriers are issued appropriately.

One thing to be aware of however - I have looked at zfs-fuse code in some
detail, and that includes code that explicitly issues disk flush commands
to the underlying block device. Unfortunately, it doesn't distinguish
between partitions and raw disks, so on some kernels it results in a flood
of warnings from the kernel about issuing an ioctl to a partition, but this
may be harmless.

The important thing to note, however, is that the same code doesn't exist
in ZoL, so if that is in fact issuing barriers, it is doing it some other
way from some other place in the code. I seem to recall asking the question
about this and I don't remember ever getting a definitive answer. Having
said that, I have never suffered data loss on ZFS due to sudden loss of
power on my ZoL systems and I always run with write caches enabled on disks.


On Wed, Sep 2, 2015 at 6:46 AM, Homer Li via zfs-discuss <
zfs-discuss at list.zfsonlinux.org> wrote:

> Hi All,
>      dmesg show disk write cache is enabled.
> sd 11:0:0:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO
> and FUA
> sd 11:0:1:0: [sdc] Write cache: enabled, read cache: enabled, supports DPO
> and FUA
> .......
> #sdparm -a /dev/sdb | grep WCE
> WCE         1  [cha: y, def:  1, sav:  1]
> http://www.solarisinternals.com/wiki/index.php/ZFS_Evil_Tuning_Guide#Cache_Flushes
> It said "ZFS is designed to work with storage devices that manage a
> disk-level cache. ZFS commonly asks the storage device to ensure that data
> is safely placed on stable storage by requesting a cache flush. "
> There is no zfs_nocacheflush in linux system. os is centos 6.6 , zfs
> version is 0.6.4-1
>  zfs set -h 2>&1 | grep cache -i
> primarycache    YES      YES   all | none | metadata
> secondarycache  YES      YES   all | none | metadata
> Default setting is
> #zfs get sync
> tank  sync      standard  default
> Disk write cache has no battery. If the JBOD enclosure power interrupt,
> Does it make data loss ?
> Should I disable disk write cache ?
> Thanks
> --
> Homer Li
> _______________________________________________
> zfs-discuss mailing list
> zfs-discuss at list.zfsonlinux.org
> http://list.zfsonlinux.org/cgi-bin/mailman/listinfo/zfs-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.zfsonlinux.org/pipermail/zfs-discuss/attachments/20150902/340da9c3/attachment.html>

More information about the zfs-discuss mailing list