svn commit: r302941 - head/usr.sbin/bsdinstall/scripts
Allan Jude
allanjude at FreeBSD.org
Sat Jul 16 19:35:05 UTC 2016
Author: allanjude
Date: Sat Jul 16 19:35:04 2016
New Revision: 302941
URL: https://svnweb.freebsd.org/changeset/base/302941
Log:
A failed installation once restarted will often error out
If an encrypted install is attempted and fails for any reason, the disk
cannot be erased by the installer because the partition is in use by GELI
At the start of the installation process, all ZFS pools are exported and
all GELI instances are detached, to allow a restarted install to proceed
PR: 210814
Reported by: jonathan
MFC after: 10 days
Modified:
head/usr.sbin/bsdinstall/scripts/zfsboot
Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot Sat Jul 16 18:28:44 2016 (r302940)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot Sat Jul 16 19:35:04 2016 (r302941)
@@ -224,6 +224,7 @@ ZFS_UNMOUNT='zfs unmount "%s"'
ZPOOL_CREATE_WITH_OPTIONS='zpool create %s "%s" %s %s'
ZPOOL_DESTROY='zpool destroy "%s"'
ZPOOL_EXPORT='zpool export "%s"'
+ZPOOL_EXPORT_F='zpool export -f "%s"'
ZPOOL_IMPORT_WITH_OPTIONS='zpool import %s "%s"'
ZPOOL_LABELCLEAR_F='zpool labelclear -f "%s"'
ZPOOL_SET='zpool set %s "%s"'
@@ -783,6 +784,14 @@ zfs_create_diskpart()
# NOTE: `-F' required to destroy if partitions still exist.
# NOTE: Failure is ok here, blank disk will have nothing to destroy.
#
+ f_dprintf "$funcname: Exporting ZFS pools..."
+ zpool list -Ho name | while read z_name; do
+ f_eval_catch -d $funcname zpool "$ZPOOL_EXPORT_F" $z_name
+ done
+ f_dprintf "$funcname: Detaching all GELI providers..."
+ geli status | tail -n +2 | while read g_name g_status g_component; do
+ f_eval_catch -d $funcname geli "$GELI_DETACH_F" $g_name
+ done
f_dprintf "$funcname: Destroying all data/layouts on \`%s'..." "$disk"
f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
f_eval_catch -d $funcname graid "$GRAID_DELETE" $disk
More information about the svn-src-head
mailing list