mirror_zfs/dracut/90zfs/export-zfs.sh.in
Lukas Wunner 07a3312f17 Amend Dracut module to export ZFS root on shutdown
Make use of Dracut's ability to restore the initramfs on shutdown and
pivot to it, allowing for a clean unmount and export of the ZFS root.
No need to force-import on every reboot anymore.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2195
Issue #2476
Issue #2498
Issue #2556
Issue #2563
Issue #2575
Issue #2600
Issue #2755
Issue #2766
2014-10-07 10:20:56 -07:00

30 lines
413 B
Bash
Executable File

#!/bin/sh
_do_zpool_export() {
local ret=0
local final=$1
local force
if [ "x$final" != "x" ]; then
force="-f"
fi
info "Exporting ZFS storage pools"
zpool list -H | while read fs rest ; do
zpool export $force "$fs" || ret=$?
done
if [ "x$final" != "x" ]; then
info "zpool list"
zpool list 2>&1 | vinfo
fi
return $ret
}
if command -v zpool >/dev/null; then
_do_zpool_export $1
else
:
fi