I had been using rsnapshot
successfully for years to backup my Ubuntu notebook computers to my Ubuntu server. I recently decided to switch to using the sync_first
option on the server and an anacron
job on my notebook to get more consistent backups since my notebook isn't always on. In case it matters, I had also been backing up by notebook hourly but switched to daily when I tried to enable sync_first
. I'm now running into two problems:
- the daily runs on the server are MOVING the
.sync
folder instead of copying it, leading to resultant syncs from the notebook being a full-backup every time - the anacron job on the notebook is not running consistently (seems to only run the first time after a reboot but then never runs again)
Here are my relevant files:
/etc/rsnapshot_josh-notebook.conf
(on the server)
config_version 1.2
snapshot_root /backups/rsnapshot/josh-notebook/
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /home/josh/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
cmd_postexec /usr/bin/rsync -az -P -H --numeric-ids --delete --rsync-path="sudo /rsync-3.1.1" --rsh="ssh -p 30535 -i /home/ssh_Backups/.ssh/id_rsa" /backups/rsnapshot/happycomputer/DaysA$
retain daily 7
retain weekly 4
retain monthly 12
retain yearly 10
verbose 2
loglevel 3
lockfile /var/run/rsnapshot.pid
rsync_short_args -azH
rsync_long_args --delete --numeric-ids --relative --delete-excluded --rsync-path="sudo /rsync-3.1.1"
ssh_args -p 30535 -i /home/ssh_Backups/.ssh/id_rsa
exclude *.log
exclude *.tmp
link_dest 1
sync_first 1
use_lazy_deletes 1
backup ssh_Backups@josh-notebook:/ ./
/etc/cron.d/rsnapshot
(on the server)
15 1 * * * root /usr/bin/rsnapshot -c /etc/rsnapshot_josh-notebook.conf daily >> /backups/rsnapshot/_logs/rsnapshot_josh-notebook.log 2>&1
15 2 * * 0 root /usr/bin/rsnapshot -c /etc/rsnapshot_josh-notebook.conf weekly >> /backups/rsnapshot/_logs/rsnapshot_josh-notebook.log 2>&1
15 5 1 * * root /usr/bin/rsnapshot -c /etc/rsnapshot_josh-notebook.conf monthly >> /backups/rsnapshot/_logs/rsnapshot_josh-notebook.log 2>&1
15 8 1 1 * root /usr/bin/rsnapshot -c /etc/rsnapshot_josh-notebook.conf yearly >> /backups/rsnapshot/_logs/rsnapshot_josh-notebook.log 2>&1
/etc/anacrontab
(on the notebook)
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root
# These replace cron's entries
1 5 cron.daily run-parts --report /etc/cron.daily
7 10 cron.weekly run-parts --report /etc/cron.weekly
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly
1 30 ssh_Backups sudo -u ssh_Backups ssh -p 30535 ssh_Backups@happycomputer "sudo /usr/bin/rsnapshot -c /etc/rsnapshot_josh-notebook.conf sync" >/tmp/ssh_Backups.errors 2>&1
When I run sudo /usr/bin/rsnapshot -t -c /etc/rsnapshot_josh-notebook.conf daily
on the server, it outputs:
echo 5246 > /var/run/rsnapshot.pid
mv /backups/rsnapshot/josh-notebook/daily.4/ \
/backups/rsnapshot/josh-notebook/daily.5/
mv /backups/rsnapshot/josh-notebook/daily.3/ \
/backups/rsnapshot/josh-notebook/daily.4/
mv /backups/rsnapshot/josh-notebook/.sync/ \
/backups/rsnapshot/josh-notebook/daily.0/
Based on some Googling, I think that last line ought to be a cp -al
instead of an mv
, which is why my .sync folder ends up gone and the client has to do a full backup each time it runs.
Can any of you please tell me if you see anything wrong with my configuration? Before enabling sync_first
, it was doing backups just fine...