Chris Dzombak

sharing preview • dzombak.com

Linux: start an mdraid check even though bash's noclobber is set

Linux: start an mdraid check even though bash's noclobber is set

A quick post for today. When trying to force my NAS’s mdraid array to run a check, in a root terminal, I got this error:

# echo check > /sys/block/md0/md/sync_action
-bash: /sys/block/md0/md/sync_action: cannot overwrite existing file

This is because I have the bash shell on all my servers configured with noclobber enabled, even for the root user’s shell, and the file does indeed already exist:

# cat /sys/block/md0/md/sync_action
idle

To overwrite this preexisting file even with noclobber enabled, use the >| operator:

# echo check >| /sys/block/md0/md/sync_action