Page 1 of 1

How does one enable the ZFS_DEBUG_MODIFY flag ?

PostPosted: Fri Dec 23, 2022 3:17 am
by dafdaf
EDIT: I just ran a search on the forum for "ZFS_DEBUG_MODIFY" and it seems the topic was discussed here:
viewtopic.php?f=26&t=3198&p=9028&hilit=ZFS_DEBUG_MODIFY

I was doing research on ZFS and ECC memory and came across this thread:
https://old.reddit.com/r/zfs/comments/8 ... d_openzfs/

found as a comment on: https://blog.codinghorror.com/to-ecc-or-not-to-ecc/

And at the risk of “appeal to authority” here’s ZFS co-founder and current ZFS dev at Delphix, Matthew Ahrens from a thread on Hardforum; see bolded sections re: the ability of ZFS to mitigate in-memory corruption with a specific debug flag (at a performance cost) as well as the bottom line re: ECC

There’s nothing special about ZFS that requires/encourages the use of ECC RAM more so than any other filesystem. If you use UFS, EXT, NTFS, btrfs, etc without ECC RAM, you are just as much at risk as if you used ZFS without ECC RAM. Actually, ZFS can mitigate this risk to some degree if you enable the unsupported ZFS_DEBUG_MODIFY flag (zfs_flags=0x10). This will checksum the data while at rest in memory, and verify it before writing to disk, thus reducing the window of vulnerability from a memory error.


https://openzfs.github.io/openzfs-docs/ ... #zfs-flags

Is it a good idea to enable this flag on an M1 macbook ? (chip would probably handle checkuming performance penalty with ease?)

If so, how does one enable that flag ?

I read ECC is not more important on ZFS than other filesystems, but I'm trying to learn all I can about it.

Thanks

Re: How does one enable the ZFS_DEBUG_MODIFY flag ?

PostPosted: Mon Dec 26, 2022 4:04 pm
by lundman
To modify "zfs_flag" use:

"sysctl kstat.zfs.darwin.tunable.zfs.flags"

"kstat.zfs.darwin.tunable.zfs.flags=x"

with the values at:

https://github.com/openzfsonosx/openzfs ... .h#L46-L59

so

#define ZFS_DEBUG_MODIFY (1 << 4)

"kstat.zfs.darwin.tunable.zfs.flags=16" (0x10)