I haven't really been following this thread but I have one question: are
mount the NAS via NFS leads me to suspect the former. It's worth noting
that this is by far the worst (i.e. least efficient) way to do it. I used
client(s) via the rsync protocol. This is not very clear from the
changed methods I saw a speedup by an order of magnitude.
huge quantities of data in order to check for modified files. Doing it the
efficiency. It also means you don't need NFS for backups (though it's still
useful for restores).
worth emphasizing and should be included in the docs.
Post by Phill EdwardsI just saw this which confirms my theory. For anyone in future...DO NOT
Post by Phill EdwardsPost by Phill Edwardsuse cmd_preexec to mount the target for the backups. While it seems
like a logical place to do it, cmd_preexec only runs for the most
frequent interval backups. So if, for example, you had daily, weekly and
monthly, cmd_preexec will only be run for the daily backups.
Sorry forgot to paste the link I saw -
http://www.backupcentral.com/phpBB2/two-way-mirrors-of-external-mailing-lists-3/rsnapshot-24/mount-backup-directory-122004/
For the benefit of the archive, I thought I would post the rsnapshot
wrapper shell script that I wrote in case anyone finds it useful in future.
And if anyone has any feedback on how it could be improved, please shout
out! The script essentially mounts the remote backup target (assumes it's a
NFS share) if it's not already mounted, then runs rsnapshot if that all
works OK, and finally unmounts it. If you wanted to mount a non-NFS share
it would be a simple change to the script.
#!/bin/sh
#
-----------------------------------------------------------------------------
#
# Script: pme_rsnapshot_wrapper.sh
# Created by PME to act as a wrapper script for rsnapshot. It's called from
# cron and mounts the target NFS backup share, checks it's mounted and then
# runs rsnapshot. When rsnapshot's finished it unmounts the target share.
#
# This is instead of using cmd_prexec and cmd_postexec configs in rsnapshot
# because they're only run fior the most frequent interval backup (ie daily)
# so don't get run for weekly and monthly backups.
#
# $1 = rsnapshot backup interval: daily, weekly or monthly
# $2 = "DUMMYRUN" if don't actually want the rsnapshot backup to run.
#
# pme_rsnapshot_wrapper.sh daily|weekly|monthly [DUMMYRUN]
#
# /bin/mount -t nfs remote.server.name:/mnt/sda2 /mnt/nas2/
#
#
-----------------------------------------------------------------------------
#
-----------------------------------------------------------------------------
# Set config variables
#
-----------------------------------------------------------------------------
# Location for target of backups.
BKUP_TARGET="remote.server.name:/mnt/sda2"
# Mount point - don't put a / on end cos it will fail grep of /proc/mounts
MNT_POINT="/mnt/nas2"
# rsnapshot executable and path (this is on a QNAP NAS)
RSNAP_EXE="/share/MD0_DATA/.qpkg/Entware-ng/bin/rsnapshot"
#
-----------------------------------------------------------------------------
# END OF CONFIG. Shouldn't need to change anything below here (unless you
want
# to add a new backup interval).
#
-----------------------------------------------------------------------------
#
-----------------------------------------------------------------------------
# Function to mount remote backup target on local dir.
#
-----------------------------------------------------------------------------
mountBackupTarget () {
if grep -qs "$MNT_POINT" /proc/mounts; then
echo "`date` pme_rsnapshot_wrapper.sh: INF: $MNT_POINT is already
mounted"
return 0
else
echo "`date` pme_rsnapshot_wrapper.sh: INF: mounting $BKUP_TARGET on
$MNT_POINT"
/bin/mount -t nfs $BKUP_TARGET $MNT_POINT
return $?
fi
}
#
-----------------------------------------------------------------------------
# Function to UNmount backup target after backup finished.
#
-----------------------------------------------------------------------------
unmountBackupTarget () {
echo "`date` pme_rsnapshot_wrapper.sh: INF: unmounting $BKUP_TARGET"
/bin/umount $BKUP_TARGET
}
#
-----------------------------------------------------------------------------
# MAIN
#
-----------------------------------------------------------------------------
# Check num of parameters passed is correct (should be at least 1)
if [ $# -lt 1 ]; then
\$1=$1"
echo " usage: pme_rsnapshot_wrapper.sh
daily|weekly|monthly"
exit 1
# Execute mount command
elif [ "$1" == "daily" ]; then
echo "`date` pme_rsnapshot_wrapper.sh: INF: rsnapshot \"$1\" requested"
# Execute UNmount command
elif [ "$1" == "weekly" ]; then
echo "`date` pme_rsnapshot_wrapper.sh: INF: rsnapshot \"$1\" requested"
# Execute UNmount command
elif [ "$1" == "monthly" ]; then
echo "`date` pme_rsnapshot_wrapper.sh: INF: rsnapshot \"$1\" requested"
# Command line parameter was some other rubbish.
else
echo "`date` pme_rsnapshot_wrapper.sh: ERR: Incorrect param \"$1\""
echo " usage: pme_rsnapshot_wrapper.sh
daily|weekly|monthly"
exit 1
fi
#
-----------------------------------------------------------------------------
# Mount remote backup target and run rsnapshot if successful.
#
-----------------------------------------------------------------------------
mountBackupTarget
RETVAL=$? # Gets return value of the mount command.
if [ "$RETVAL" -eq 0 ]; then
echo "`date` pme_rsnapshot_wrapper.sh: INF: $BKUP_TARGET mounted OK"
if [ "$2" == "DUMMYRUN" ]; then
echo "`date` pme_rsnapshot_wrapper.sh: INF: $2 so rsnapshot not
executed"
else
echo "`date` pme_rsnapshot_wrapper.sh: INF: running $RSNAP_EXE $1"
$RSNAP_EXE $1 # Run rsnapshot backup
fi
unmountBackupTarget # UNmount backup directory when rsnapshot completed.
else
echo "`date` pme_rsnapshot_wrapper.sh: ERR: $BKUP_TARGET mount failed
with code $RETVAL"
exit 1
fi
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data
untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
rsnapshot-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss