Hi,
I have 2 servers that I want to backup to another server outside the datacentre..
Could you please tell me what is the best option to do so safely?
So far I created the following on the backup server..
ps: The backup zfs pool is also called zroot
When I
When I
Could anyone please tell me why or help me understand?
when I do
we keep loosing remote access via ssh to the backup server has the user is no longer their
script for trinity
Script for r610
I have 2 servers that I want to backup to another server outside the datacentre..
Could you please tell me what is the best option to do so safely?
So far I created the following on the backup server..
zfs create zroot/trinity
zfs create zroot/r610
ps: The backup zfs pool is also called zroot
When I
zfs send
the data from server 1 (trinity) everything is okWhen I
zfs send
data from server1 (r610), the backup home directory get overwritten by the home directory of the r610 serverCould anyone please tell me why or help me understand?
when I do
zfs list -t snapshot
I can see that both zfs send was recieved sucessfullywe keep loosing remote access via ssh to the backup server has the user is no longer their
script for trinity
Code:
#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:
pool="zroot"
destination="zroot/trinity"
host="82.27.xxx.xxx"
if [ -f /tmp/backupscript.lock ]; then
logger -p local5.notice "Backup did not complete yesterday FAILED"
echo "Backup did not complete yesterday FAILED" | /usr/bin/mail -s "Backup Report" root
exit 1
else
touch /tmp/backupscript.lock
fi
today=`date +"$type-%Y-%m-%d"`
yesterday=`date -v -1d +"$type-%Y-%m-%d"`
day=`date -v -30d +"$type-%Y-%m-%d"`
# create today snapshot
snapshot_today="$pool@$today"
# look for a snapshot with this name
if zfs list -H -o name -t snapshot | sort | grep "$snapshot_today$" > /dev/null; then
logger -p local5.notice "snapshot, $snapshot_today, already exists skipping"
else
logger -p local5.notice "Taking todays snapshot, $snapshot_today"
zfs snapshot -r $snapshot_today
fi
# look for yesterday snapshot
snapshot_yesterday="$pool@$yesterday"
if zfs list -H -o name -t snapshot | sort | grep "$snapshot_yesterday$" > /dev/null; then
if zfs send -R -i $snapshot_yesterday $snapshot_today | mbuffer -q -v 0 -s 128k -m 1G | ssh root@$host "mbuffer -s 128k -m 1G | zfs receive -Fdu $destination" > 0; then
logger -p local5.notice "Backup OK"
echo "Backup OK" | /usr/bin/mail -s "Backup Report" root
else
logger -p local5.error "Backup FAILED"
echo "Backup FAILED" | /usr/bin/mail -s "Backup Report" root
exit 1
fi
rm /tmp/backupscript.lock
zfs destroy -r $day
exit 0
else
logger -p local5.error "missing yesterday snapshot Backup FAILED"
exit 1
fi
Code:
#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:
pool="zroot"
destination="zroot/r610"
host="82.27.xxx.xxx"
if [ -f /tmp/backupscript.lock ]; then
logger -p local5.notice "Backup did not complete yesterday FAILED"
echo "Backup did not complete yesterday FAILED" | /usr/bin/mail -s "Backup Report" root
exit 1
else
touch /tmp/backupscript.lock
fi
today=`date +"$type-%Y-%m-%d"`
yesterday=`date -v -1d +"$type-%Y-%m-%d"`
day=`date -v -30d +"$type-%Y-%m-%d"`
# create today snapshot
snapshot_today="$pool@$today"
# look for a snapshot with this name
if zfs list -H -o name -t snapshot | sort | grep "$snapshot_today$" > /dev/null; then
logger -p local5.notice "snapshot, $snapshot_today, already exists skipping"
else
logger -p local5.notice "Taking todays snapshot, $snapshot_today"
zfs snapshot -r $snapshot_today
fi
# look for yesterday snapshot
snapshot_yesterday="$pool@$yesterday"
if zfs list -H -o name -t snapshot | sort | grep "$snapshot_yesterday$" > /dev/null; then
if zfs send -R -i $snapshot_yesterday $snapshot_today | mbuffer -q -v 0 -s 128k -m 1G | ssh root@$host "mbuffer -s 128k -m 1G | zfs receive -Fdu $destination" > 0; then
logger -p local5.notice "Backup OK"
echo "Backup OK" | /usr/bin/mail -s "Backup Report" root
else
logger -p local5.error "Backup FAILED"
echo "Backup FAILED" | /usr/bin/mail -s "Backup Report" root
exit 1
fi
rm /tmp/backupscript.lock
zfs destroy -r $day
exit 0
else
logger -p local5.error "missing yesterday snapshot Backup FAILED"
exit 1
fi