3 # ZFS/ZPOOL configuration test script.
5 basedir="$(dirname $0)"
7 SCRIPT_COMMON=common.sh
8 if [ -f "${basedir}/${SCRIPT_COMMON}" ]; then
9 . "${basedir}/${SCRIPT_COMMON}"
11 echo "Missing helper script ${SCRIPT_COMMON}" && exit 1
29 -x Destructive hd/sd/md/dm/ram tests
30 -f Don't prompt due to -x
31 -c Cleanup lo+file devices at start
36 while getopts 'hvxfc?' OPTION; do
61 if [ $(id -u) != 0 ]; then
62 die "Must run as root"
65 # Perform pre-cleanup is requested
66 if [ ${CLEANUP} ]; then
68 rm -f /tmp/zpool.cache.*
76 ${ZPIOS_SH} -f -c ${CONFIG} -t ${TEST} &>${LOG}
80 if [ ${VERBOSE} ]; then
81 printf "FAIL: %-13s\n" ${CONFIG}
84 if [ ! ${HEADER} ]; then
89 printf "FAIL: %-13s" ${CONFIG}
93 if [ ${VERBOSE} ]; then
96 if [ ! ${HEADER} ]; then
108 if [ ${DANGEROUS} ] && [ ! ${FORCE} ]; then
110 The -x option was passed which will result in UNRECOVERABLE DATA LOSS
111 on on the following block devices:
119 To continue please confirm by entering YES:
122 if [ ${CONFIRM} != "YES" ] && [ ${CONFIRM} != "yes" ]; then
128 # These configurations are all safe and pose no risk to any data on
129 # the system which runs them. They will confine all their IO to a
130 # file in /tmp or a loopback device configured to use a file in /tmp.
133 file-raid0 file-raid10 file-raidz file-raidz2 \
134 lo-raid0 lo-raid10 lo-raidz lo-raidz2 \
138 # These configurations are down right dangerous. They will attempt
139 # to use various real block devices on your system which may contain
140 # data you car about. You are STRONGLY advised not to run this unless
141 # you are certain there is no data on the system you care about.
143 DANGEROUS_CONFIGS=( \
147 md0-raid10 md0-raid5 \
151 for CONFIG in ${SAFE_CONFIGS[*]}; do
152 zpios_test $CONFIG tiny
155 if [ ${DANGEROUS} ]; then
156 for CONFIG in ${DANGEROUS_CONFIGS[*]}; do
157 zpios_test $CONFIG tiny