Post by Scott HessOn the one hand, releasing the lock earlier may allow a later rsnapshot to
successfully get the lock, which sounds good. On the other hand, having a
later rsnapshot run in parallel with the earlier rsnapshot's delete means
they will be competing for limited I/O bandwidth, so the later rsnapshot
will run more slowly.
Drat. Short of commenting out rm_rf(
"$config_vars{'snapshot_root'}/_delete.$$" ); in the source, is there a way
to tell rsnapshot to leave the _delete.$$ dirs around for cron to clean up
later? I realize this isn't ideal as it doesn't free up disk space.
Which scenarios would that help? The delete isn't going to be faster later
on. Maybe you should describe the specific scenario which is causing you
to wish to turn this feature on?
Hmm. I forgot that lazy_deletes also moves the delete from before the
snapshot to after, so your snapshot is made closer to when you ran the
command. Here's a snippet from my rsnapshot.log:
[10/Mar/2016:12:00:37] /usr/bin/rsnapshot hourly: started
[10/Mar/2016:12:00:37] echo 3105 > /var/run/rsnapshot.pid
[10/Mar/2016:12:00:37] mv /.snapshots/hourly.3/ /.snapshots/_delete.3105/
[10/Mar/2016:12:00:37] mv /.snapshots/hourly.2/ /.snapshots/hourly.3/
[10/Mar/2016:12:00:37] mv /.snapshots/hourly.1/ /.snapshots/hourly.2/
[10/Mar/2016:12:00:37] mv /.snapshots/hourly.0/ /.snapshots/hourly.1/
[10/Mar/2016:12:00:37] /bin/cp -al /.snapshots/.sync /.snapshots/hourly.0
[10/Mar/2016:12:06:07] rm -f /var/run/rsnapshot.pid
[10/Mar/2016:12:06:07] /bin/rm -rf /.snapshots/_delete.3105
[10/Mar/2016:12:11:55] /usr/bin/rsnapshot hourly: completed successfully
Without lazy_deletes, the five minutes spent in the last rm would come
before the cp.
The place I found lazy_deletes to be most helpful is in the intervals past
the first one. For those, new snapshots are never created, they are only
stolen from earlier periods, like this:
[10/Mar/2016:03:45:01] /usr/bin/rsnapshot daily: started
[10/Mar/2016:03:45:01] echo 2530 > /var/run/rsnapshot.pid
[10/Mar/2016:03:45:01] mv /.snapshots/daily.6/ /.snapshots/_delete.2530/
[10/Mar/2016:03:45:01] mv /.snapshots/daily.5/ /.snapshots/daily.6/
[10/Mar/2016:03:45:01] mv /.snapshots/daily.4/ /.snapshots/daily.5/
[10/Mar/2016:03:45:01] mv /.snapshots/daily.3/ /.snapshots/daily.4/
[10/Mar/2016:03:45:01] mv /.snapshots/daily.2/ /.snapshots/daily.3/
[10/Mar/2016:03:45:01] mv /.snapshots/daily.1/ /.snapshots/daily.2/
[10/Mar/2016:03:45:01] mv /.snapshots/daily.0/ /.snapshots/daily.1/
[10/Mar/2016:03:45:01] mv /.snapshots/hourly.3/ /.snapshots/daily.0/
[10/Mar/2016:03:45:01] rm -f /var/run/rsnapshot.pid
[10/Mar/2016:03:45:01] /bin/rm -rf /.snapshots/_delete.2530
[10/Mar/2016:03:49:07] /usr/bin/rsnapshot daily: completed successfully
Once a week, my daily runs after weekly, in which case the rm doesn't
happen (since weekly stole the oldest daily). Without lazy_deletes, I had
to be careful to space out my cron jobs so that there was time to run the
delete pass before the next job was started. With lazy_deletes, both cases
are about the same, so I can bunch things up more. I still leave a
generous time buffer between the last non-hourly job and the first hourly
job, but I don't have to worry as much about timing.
-scott