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
28 -x Destructive hd/sd/md/dm/ram tests
29 -f Don't prompt due to -x
30 -c Cleanup lo+file devices at start
35 while getopts 'hvxfc?' OPTION; do
60 if [ $(id -u) != 0 ]; then
61 die "Must run as root"
64 # Perform pre-cleanup is requested
65 if [ ${CLEANUP} ]; then
67 rm -f /tmp/zpool.cache.*
75 ${ZPIOS_SH} -f -c ${CONFIG} -t ${TEST} &>${LOG}
77 if [ ${VERBOSE} ]; then
78 printf "FAIL: %-13s\n" ${CONFIG}
81 if [ ! ${HEADER} ]; then
86 printf "FAIL: %-13s" ${CONFIG}
90 if [ ${VERBOSE} ]; then
93 if [ ! ${HEADER} ]; then
105 if [ ${DANGEROUS} ] && [ ! ${FORCE} ]; then
107 The -x option was passed which will result in UNRECOVERABLE DATA LOSS
108 on on the following block devices:
116 To continue please confirm by entering YES:
119 if [ ${CONFIRM} != "YES" ] && [ ${CONFIRM} != "yes" ]; then
125 # These configurations are all safe and pose no risk to any data on
126 # the system which runs them. They will confine all their IO to a
127 # file in /tmp or a loopback device configured to use a file in /tmp.
130 file-raid0 file-raid10 file-raidz file-raidz2 \
131 lo-raid0 lo-raid10 lo-raidz lo-raidz2 \
135 # These configurations are down right dangerous. They will attempt
136 # to use various real block devices on your system which may contain
137 # data you car about. You are STRONGLY advised not to run this unless
138 # you are certain there is no data on the system you care about.
140 DANGEROUS_CONFIGS=( \
144 md0-raid10 md0-raid5 \
148 for CONFIG in ${SAFE_CONFIGS[*]}; do
149 zpios_test $CONFIG tiny
152 if [ ${DANGEROUS} ]; then
153 for CONFIG in ${DANGEROUS_CONFIGS[*]}; do
154 zpios_test $CONFIG tiny