zfs-ram-verify-toggle 🐏




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
- Create the Script:
sudo vim /usr/local/bin/zfs-game-toggle
Paste your script content (ensure it uses#!/bin/bashat the top). - Make it Executable:
sudo chmod +x /usr/local/bin/zfs-game-toggle
- 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
- 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 zfsfirst if needed. - System Responsiveness: When you run the
stopcommand (enabling debug mode),…
评论
?
参与讨论