will now send raw streams of encrypted data [closes #3]
This commit is contained in:
parent
2e8b4d8387
commit
d9a92e62c4
|
@ -82,6 +82,18 @@ function backup() {
|
||||||
# take a snapshot
|
# take a snapshot
|
||||||
/usr/sbin/zfs snapshot -r ${NEWSNAP}
|
/usr/sbin/zfs snapshot -r ${NEWSNAP}
|
||||||
|
|
||||||
|
# check if source is encrypted
|
||||||
|
if [ $ENCRYPTION_FEATURE != "disabled" ]
|
||||||
|
then
|
||||||
|
# encryption feature available
|
||||||
|
ENCRYPTION=$(/usr/sbin/zfs get -Ho value encryption ${DATASET})
|
||||||
|
if [[ ${ENCRYPTION} != "off" ]]
|
||||||
|
then
|
||||||
|
# encryption in use, send raw stream
|
||||||
|
RAW_MOD="w"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# determine whether to do differential send or not
|
# determine whether to do differential send or not
|
||||||
if [ ! -z ${LASTSNAP} ]
|
if [ ! -z ${LASTSNAP} ]
|
||||||
then
|
then
|
||||||
|
@ -95,7 +107,7 @@ function backup() {
|
||||||
R_SNAPMODIFIER="I $(dirname ${DATASET})/$(basename ${R_SNAPSHOTS[*]:(-1)})"
|
R_SNAPMODIFIER="I $(dirname ${DATASET})/$(basename ${R_SNAPSHOTS[*]:(-1)})"
|
||||||
fi
|
fi
|
||||||
# send any previous snapshots
|
# send any previous snapshots
|
||||||
/usr/sbin/zfs send -R${R_SNAPMODIFIER} ${LASTSNAP} | ${RMOD} /usr/sbin/zfs recv -Feuv ${SAVETO} 2>&1 >> ${LOGFILE}
|
/usr/sbin/zfs send -R${RAW_MOD}${R_SNAPMODIFIER} ${LASTSNAP} | ${RMOD} /usr/sbin/zfs recv -Feuv ${SAVETO} 2>&1 >> ${LOGFILE}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# ensure this does not remain in effect
|
# ensure this does not remain in effect
|
||||||
|
@ -103,7 +115,7 @@ function backup() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# send backup
|
# send backup
|
||||||
/usr/sbin/zfs send -R${SNAPMODIFIER} ${NEWSNAP} | ${RMOD} /usr/sbin/zfs recv -Feuv ${SAVETO} 2>&1 >> ${LOGFILE}
|
/usr/sbin/zfs send -R${RAW_MOD}${SNAPMODIFIER} ${NEWSNAP} | ${RMOD} /usr/sbin/zfs recv -Feuv ${SAVETO} 2>&1 >> ${LOGFILE}
|
||||||
|
|
||||||
# if replication is unsuccessful, omit the aging check so as to prevent data loss
|
# if replication is unsuccessful, omit the aging check so as to prevent data loss
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
|
@ -162,7 +174,7 @@ function backup() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# reset remote configuration
|
# reset remote configuration
|
||||||
unset R_RMOD RMOD
|
unset R_RMOD RMOD RAW_MOD
|
||||||
}
|
}
|
||||||
|
|
||||||
#### END FUNCTIONS ####
|
#### END FUNCTIONS ####
|
||||||
|
@ -173,7 +185,7 @@ while getopts hf:m: OPTION
|
||||||
do
|
do
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
f)
|
f)
|
||||||
# configuration file for install mode
|
# configuration file
|
||||||
CFGFILE="$OPTARG"
|
CFGFILE="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -211,6 +223,15 @@ if [[ "$PLATFORM_VERSION" =~ ^joyent ]]
|
||||||
then
|
then
|
||||||
# SmartOS GZ has GNU date shipped by default but no perl interpreter on-board
|
# SmartOS GZ has GNU date shipped by default but no perl interpreter on-board
|
||||||
TIMECMD="\$(date +%s)"
|
TIMECMD="\$(date +%s)"
|
||||||
|
# determine pool name
|
||||||
|
POOL_NAME=$(/usr/bin/sysinfo | /usr/bin/json Zpool)
|
||||||
|
ENCRYPTION_FEATURE=$(/usr/sbin/zpool get -Ho value feature@encryption ${POOL_NAME})
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
# feature unknown, outdated PI
|
||||||
|
logger -t $(basename ${0%.sh}) -p user.notice "ZFS encryption is not supported on $PLATFORM_VERSION"
|
||||||
|
ENCRYPTION_FEATURE="disabled"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# determine current timestamp
|
# determine current timestamp
|
||||||
|
|
Loading…
Reference in New Issue