Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When creating ZFS datasets, check for the parent dataset. If it does …

…*not*

exist, then we will create a parent with the "canmount=off" flag first.
  • Loading branch information...
commit 3f8cc132f2d72197f6109e7525fe1b66a6bcbc85 1 parent d64173f
@kmoore134 kmoore134 authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 src-sh/pc-sysinstall/backend/functions-mountdisk.sh
View
33 src-sh/pc-sysinstall/backend/functions-mountdisk.sh
@@ -91,6 +91,39 @@ mount_partition()
else
ZNAME="${ZMNT}"
ZMKMNT="${ZMNT}"
+
+ # Lets check if we are missing any parent dataset
+ chkDir=`dirname $ZMNT`
+ mkParents=""
+ while
+ z=0
+ do
+ # Are we at the base dataset?
+ if [ "$chkDir" = "/" ]; then break ; fi
+
+ # Do we have this dataset?
+ zfs list | grep -q "^${ZPOOLNAME}${chkDir} "
+ if [ $? -eq 0 ]; then break ; fi
+
+ # Save this dataset to create
+ mkParents="$chkDir $mkParents"
+
+ # Get the next dir to check
+ chkDir=`dirname $chkDir`
+ done
+
+ # Any ZFS parent datasets to create?
+ if [ -n "$mkParents" ] ; then
+ for p in $mkParents
+ do
+ # Since the user didn't explictly specify this dataset
+ # we assume they don't really want it mounted
+ echo_log "zfs create -o canmount=off -p ${ZPOOLNAME}${p}"
+ rc_halt "zfs create -o canmount=off -p ${ZPOOLNAME}${p}"
+ done
+ fi
+
+ # Create the target ZFS dataset now
echo_log "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}"
rc_halt "zfs create $zcopt -p ${ZPOOLNAME}${ZNAME}"
fi
Please sign in to comment.
Something went wrong with that request. Please try again.