Skip to content

Commit

Permalink
Initial support for block device cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
gozora committed Dec 6, 2016
1 parent 27c26e6 commit 1db133f
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 15 deletions.
27 changes: 27 additions & 0 deletions usr/share/rear/backup/BLOCKCLONE/default/500_start_clone.sh
@@ -0,0 +1,27 @@
# This file is part of Relax-and-Recover, licensed under the GNU General
# Public License. Refer to the included COPYING for full text of license.
#
# 500_start_clone.sh

local backup_directory=$BUILD_DIR/outputfs/$NETFS_PREFIX

# BLOCKCLONE progs could be handled here
case "$(basename ${BLOCKCLONE_PROG})" in
(ntfsclone)
ntfsclone -q --save-image $BLOCKCLONE_COMMAND_OPTS \
-O $backuparchive $BLOCKCLONE_SOURCE_DEV
;;
(dd)
# This does not work yet, only a placeholder
dd $BLOCKCLONE_COMMAND_OPTS
;;
esac

# Save MBR data if $BLOCKCLONE_SAVE_MBR_DEV is set (non-empty)
# ${BACKUP_PROG_ARCHIVE}_mbr.img will be used for partitioning (quick an dirty)
# Dualboot on single disk DOES NOT YET WORK !!!
if [ $BLOCKCLONE_SAVE_MBR_DEV ]; then
Log "Creating MBR image"
dd if=$BLOCKCLONE_SAVE_MBR_DEV of=$backup_directory/${BACKUP_PROG_ARCHIVE}_mbr.img bs=512 count=1
StopIfError "Failed to save MBR image"
fi
25 changes: 10 additions & 15 deletions usr/share/rear/conf/default.conf
Expand Up @@ -100,25 +100,12 @@ OS_VERSION=none
# keep the build area after we are done ? (BOOL)
KEEP_BUILD_DIR=""

# No default workflows. This variable is filled in where the workflows are defined
# no default workflows. This variable is filled in where the worklflows are defined
# without the empty string as initial value WORKFLOWS and LOCKLESS_WORKFLOWS would
# be unbound variables that would result an error exit if 'set -eu' is used:
WORKFLOWS=("")
# Allow some workflows to not lock and use a separate logfile named 'LOGFILE.lockless'.
# The LOCKLESS_WORKFLOWS array gets filled during runtime as needed by the various
# usr/share/rear/lib/WORKFLOW-workflow.sh scripts. Currently the following workflows
# add themselves to the LOCKLESS_WORKFLOWS array: checklayout dump help
# allow some workflows to not lock, also generates a separate log
LOCKLESS_WORKFLOWS=("")
# SIMULTANEOUS_RUNNABLE_WORKFLOWS are also allowed to run simultaneously
# but cannot use LOGFILE.lockless as the LOCKLESS_WORKFLOWS.
# Instead the SIMULTANEOUS_RUNNABLE_WORKFLOWS get a LOGFILE with PID
# because simultaneously runnable workflows require unique logfile names
# so that the PID is interposed in the LOGFILE value from default.conf above,
# i.e. by default SIMULTANEOUS_RUNNABLE_WORKFLOWS use during runtime
# a logfile named /var/log/rear/rear-$HOSTNAME.$$.log that gets
# at the end copied to a final possibly used-defined LOGFILE,
# see /usr/sbin/rear and https://github.com/rear/rear/issues/1102
SIMULTANEOUS_RUNNABLE_WORKFLOWS=( 'mkbackuponly' 'restoreonly' )

# default backup and output targets
BACKUP=REQUESTRESTORE
Expand Down Expand Up @@ -724,6 +711,14 @@ BORGBACKUP_PRUNE_WEEKLY=
BORGBACKUP_PRUNE_MONTHLY=
BORGBACKUP_PRUNE_YEARLY=

##
# BACKUP=BLOCKCLONE
##
BLOCKCLONE_SOURCE_DEV=""
BLOCKCLONE_PROG=""
BLOCKCLONE_COMMAND_OPTS=""
BLOCKCLONE_SAVE_MBR_DEV=""

# Environment variables
# Borg is using couple of environment variables which can influence its behavior.
# You can make use of them by putting 'export BORG_var_name="var_value"'
Expand Down

0 comments on commit 1db133f

Please sign in to comment.