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
70 rm -f /tmp
/zpool.cache.
*
78 ${ZPIOS_SH} -f -c ${CONFIG} -t ${TEST} &>${LOG}
82 if [ ${VERBOSE} ]; then
83 printf "FAIL: %-13s\n" ${CONFIG}
86 if [ ! ${HEADER} ]; then
91 printf "FAIL: %-13s" ${CONFIG}
95 if [ ${VERBOSE} ]; then
98 if [ ! ${HEADER} ]; then
110 if [ ${DANGEROUS} ] && [ ! ${FORCE} ]; then
112 The -x option was passed which will result in UNRECOVERABLE DATA LOSS
113 on on the following block devices:
121 To continue please confirm by entering YES:
124 if [ ${CONFIRM} != "YES" ] && [ ${CONFIRM} != "yes" ]; then
130 # These configurations are all safe and pose no risk to any data on
131 # the system which runs them. They will confine all their IO to a
132 # file in /tmp or a loopback device configured to use a file in /tmp.
135 file-raid0 file-raid10 file-raidz file-raidz2 \
136 lo-raid0 lo-raid10 lo-raidz lo-raidz2 \
140 # These configurations are down right dangerous. They will attempt
141 # to use various real block devices on your system which may contain
142 # data you car about. You are STRONGLY advised not to run this unless
143 # you are certain there is no data on the system you care about.
145 DANGEROUS_CONFIGS
=( \
149 md0-raid10 md0-raid5 \
153 TMP_CACHE
=`mktemp -p /tmp zpool.cache.XXXXXXXX`
154 ${ZFS_SH} zfs
="spa_config_path=${TMP_CACHE}" || die
"Unable to load modules"
156 for CONFIG
in ${SAFE_CONFIGS[*]}; do
157 zpios_test
$CONFIG tiny
160 if [ ${DANGEROUS} ]; then
161 for CONFIG
in ${DANGEROUS_CONFIGS[*]}; do
162 zpios_test
$CONFIG tiny