3 # A simple script to simply the loading/unloading the ZFS module stack.
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
14 # shellcheck disable=SC2034
21 $0 [hvud] [module-options]
24 Load/unload the ZFS module stack.
32 Must be of the from module="options", for example:
34 $0 zfs="zfs_prefetch_disable=1"
35 $0 zfs="zfs_prefetch_disable=1 zfs_mdcomp_disable=1"
40 while getopts 'hvu' OPTION
; do
47 # shellcheck disable=SC2034
60 if [ "$(id -u)" != 0 ]; then
61 die
"Must run as root"
64 if [ ${UNLOAD} ]; then
71 check_modules || die
"${ERROR}"
72 load_modules
"$@" || die
"Failed to load modules"
73 wait_udev
/dev
/zfs
30 || die
"'/dev/zfs' was not created"