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 # Initialize the test suite
68 # Perform pre-cleanup is requested
69 if [ ${CLEANUP} ]; then
73 rm -f /tmp
/zpool.cache.
*
81 ${ZPIOS_SH} -f -c ${CONFIG} -t ${TEST} &>${LOG}
85 if [ ${VERBOSE} ]; then
86 printf "FAIL: %-13s\n" ${CONFIG}
89 if [ ! ${HEADER} ]; then
94 printf "FAIL: %-13s" ${CONFIG}
98 if [ ${VERBOSE} ]; then
101 if [ ! ${HEADER} ]; then
113 if [ ${DANGEROUS} ] && [ ! ${FORCE} ]; then
115 The -x option was passed which will result in UNRECOVERABLE DATA LOSS
116 on on the following block devices:
124 To continue please confirm by entering YES:
127 if [ ${CONFIRM} != "YES" ] && [ ${CONFIRM} != "yes" ]; then
133 # These configurations are all safe and pose no risk to any data on
134 # the system which runs them. They will confine all their IO to a
135 # file in /tmp or a loopback device configured to use a file in /tmp.
138 file-raid0 file-raid10 file-raidz file-raidz2 \
139 lo-raid0 lo-raid10 lo-raidz lo-raidz2 \
143 # These configurations are down right dangerous. They will attempt
144 # to use various real block devices on your system which may contain
145 # data you car about. You are STRONGLY advised not to run this unless
146 # you are certain there is no data on the system you care about.
148 DANGEROUS_CONFIGS
=( \
152 md0-raid10 md0-raid5 \
156 TMP_CACHE
=`mktemp -p /tmp zpool.cache.XXXXXXXX`
157 ${ZFS_SH} zfs
="spa_config_path=${TMP_CACHE}" || die
"Unable to load modules"
159 for CONFIG
in ${SAFE_CONFIGS[*]}; do
160 zpios_test
$CONFIG tiny
163 if [ ${DANGEROUS} ]; then
164 for CONFIG
in ${DANGEROUS_CONFIGS[*]}; do
165 zpios_test
$CONFIG tiny