ansitest/VIRTBOX/faildisk.sh
2022-06-30 11:09:30 -05:00

13 lines
332 B
Bash

#!/bin/bash
# arg = shortname disk e.g. sdc , omit the /dev
# Primarily used in ZFS VM to simulate disk failures in a zpool / test RAIDZx / DRAID recovery scenarios
# NOTE rebooting will fix the failed disks
echo "Failing $1"
echo offline > /sys/block/$1/device/state
echo 1 > /sys/block/$1/device/delete
sleep 2
dmesg|grep $1