# For each filesystem we are supposed to restore, do it
for filesystem in $filesystems_to_replicate; do
+ if [[ $filesystem =~ ':' ]]; then
+ src_pool=${filesystem%%:*}
+ filesystem=${filesystem#*:} # remove src_pool from string
+ else
+ src_pool=${backup_pool%% *} # use the first backup pool if none specified
+ fi
dst_pool=${filesystem%%/*}
dst_fs=${filesystem#*/}
# Check to make sure the dst filesystem does not exist
if [ $? == 0 ]; then
# This filesystem matches our restore pool pattern
echo `date` Restoring $filesystem to $remote
- zfs-restore $backup_pool $filesystem $dst_pool $dst_fs $remote
+ zfs-restore $src_pool $filesystem $dst_pool $dst_fs $remote
fi
else
echo "-I- Filesystem already exists on destination. Skipping: $filesystem"