zfs-ram-verify-toggle 🐏

zfs-ram-verify-toggle 🐏 图片 1
zfs-ram-verify-toggle 🐏 图片 2
zfs-ram-verify-toggle 🐏 图片 3
zfs-ram-verify-toggle 🐏 图片 4

README.md

ZFS Software ECC Dynamic Toggle

Context-aware memory verification for non-ECC RAM. Fail-loud design.

🖧 Automated toggle for zfs_flags=0x10 (ZFS_DEBUG_MODIFY). Enables in-memory data verification on non-ECC RAM during idle/server tasks to prevent silent corruption, and disables it during gaming (Steam) to maximize performance. Implements the mitigation strategy recommended by Matthew Ahrens for non-ECC systems.

#!/bin/bash
# Requires sudo privileges for sysfs writes
MODE=$1

if [ "$MODE" == "start" ]; then
    # Disable Debug, Flush Cache
    echo 0 > /sys/module/zfs/parameters/zfs_flags
    echo 0 > /sys/module/zfs/parameters/zfs_arc_shrinker_limit
    echo 3 > /proc/sys/vm/drop_caches
elif [ "$MODE" == "stop" ]; then
    # Enable Debug (16 = 0x10)
    echo 16 > /sys/module/zfs/parameters/zfs_flags
    # Optional: Flush again to ensure debug mode starts clean
    echo 3 > /proc/sys/vm/drop_caches
fi

How to Test Safely

  1. Create the Script:
    sudo vim /usr/local/bin/zfs-game-toggle
    Paste your script content (ensure it uses #!/bin/bash at the top).
  2. Make it Executable:
    sudo chmod +x /usr/local/bin/zfs-game-toggle
  3. Run the Test: Execute the command to switch to "game mode" (disable ECC checking):
    sudo /usr/local/bin/zfs-game-toggle start
    Then verify the change immediately:
    cat /sys/module/zfs/parameters/zfs_flags
    # Output should be: 0
  4. Revert to Storage Mode:
    sudo /usr/local/bin/zfs-game-toggle stop
    cat /sys/module/zfs/parameters/zfs_flags
    # Output should be: 16

Critical Checks During Testing

  • Permission Errors: If you get "Permission denied" even with sudo, ensure the script itself is owned by root (ls -l /usr/local/bin/zfs-game-toggle).
  • ZFS Module Loaded: If you get "No such file or directory" for the parameters, the ZFS module might not be loaded yet (unlikely on a root-on-ZFS install, but possible if testing before mounting). Run sudo modprobe zfs first if needed.
  • System Responsiveness: When you run the stop command (enabling debug mode),…
添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论