Hi Bernd,
On Mon, Jun 15, 2015 at 07:46:31AM +0100, Bernd Schoeller wrote:
| Hi -
|
| I have got an OpenBSD box, and I would like to create regular full backups
| of that box to a Linux server at a different location.
|
| The main purpose of this backup is to be able to restore the OpenBSD box on
| a severe hardware failure (HD corruption, fire, etc.). If possible, the
| backup should be incremental as I am somewhat bandwidth constrained between
| the two sites.
|
| There are a number of remote backup systems floating around (rdiff-backup,
| rsnapshot, etc.) and of course there are in-house solutions (dump/restore),
| though I don't know if these are interoperable.
|
| Is there somebody on the list who has a similar setup and could point me at
| a solution that works for him/her?
I wrote my own script that uses rsync with --link-dest, which I dubbed
'lnbackup'. First some other scripts copy data to the backup disk
(locally or remotely), just rsyncing the changes into a machines/
directory. Then lnbackup rsyncs all of machines/ to a new directory
per day, with --link-dest set to the previous day's tree.
It keeps a configurable number of daily backups, 12 monthly backups
and infinite yearly backups (delete those when the need arrives).
Included here for your convenience.
Cheers,
Paul 'WEiRD' de Weerd
--- /etc/lnbackup.conf -----------------------------------------------
DATESTRING="%Y%m%d"
STOREPREFIX="/backup/HISTORY/daily"
BACKUPPREFIX="/backup/machines"
KEEPCOPIES=190
KEEPCOPIES=120
#!/bin/sh
# lnbackup: create historic backups of the backup directories
######################################################################
PATH=/bin:/usr/bin:/usr/local/bin
CONFIG="/etc/lnbackup.conf"
if [ -f ${CONFIG} ]
then
. ${CONFIG}
else
echo Configuration file \(${CONFIG}\) not found >&2
exit 1
fi
NOW=$(date +${DATESTRING})
COUNT=0
if [ ! -r ${USERSFILE} ]
then
echo Users file not found \(${USERSFILE}\) >&2
exit 2
fi
if [ -f ${STOREPREFIX}/.RUNNING ]
then
PID=$(cat ${STOREPREFIX}/.RUNNING)
echo Previous instance still running \(${PID}\) >&2
exit 3
fi
echo ${$} > ${STOREPREFIX}/.RUNNING
if [ -f ${STOREPREFIX}/PREVIOUS ]
then
PREVIOUS=$(cat ${STOREPREFIX}/PREVIOUS)
else
PREVIOUS='0'
fi
if [ ${NOW} = ${PREVIOUS} ]
then
echo Backup runs too soon \(${PREVIOUS}\) >&2
exit 4
fi
for USER in $(cat ${USERSFILE})
do
SRC=${BACKUPPREFIX}/${USER}/
if [ ! -d ${SRC} ]
then
echo Source not found \(${SRC}\) >&2
exit 5
fi
DST=${STOREPREFIX}/${NOW}/${USER}
mkdir -p ${DST}
PREVDIR=${STOREPREFIX}/${PREVIOUS}/${USER}
if [ -d ${PREVDIR} ]
then
rsync -aHx --link-dest=${PREVDIR} ${SRC} ${DST}
else
rsync -aHx ${SRC} ${DST}
fi
done
echo ${NOW} > ${STOREPREFIX}/PREVIOUS
rm ${STOREPREFIX}/.RUNNING
for BACKUP in $(ls ${STOREPREFIX} | grep -v PREVIOUS | tail -r)
do
SB=${STOREPREFIX}/${BACKUP}
YRLY=${STOREPREFIX}/../yearly
MNLY=${STOREPREFIX}/../monthly
COUNT=$((COUNT + 1))
if [ ${KEEPCOPIES} -lt ${COUNT} ]
then
if [ ${BACKUP##????} = '0101' ]
then
mv ${SB} ${YRLY}
continue
fi
if [ ${BACKUP##??????} = '01' ]
then
mv ${SB} ${MNLY}
rm -rf ${MNLY}/$((BACKUP-10000))
continue
fi
rm -rf ${SB}
fi
done
----------------------------------------------------------------------
--
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
http://www.weirdnet.nl/