On Mon, Nov 15, 2021 at 5:05 AM andrew via Duplicity-talk
<duplicity-talk@nongnu.org> wrote:
How do I force duplicity to restore from the last full backup which it
made? I can see the options for creating a new full back-up but not
restoring it. Indeed, how do I find out when the last full backup was
made.
To state the [non?] obvious, you have to know when the last full
backup was created. Then you can restore from that particular date.
To keep a "restore from full backup" simple, I use the following
recipe that runs each night. It performs a full backup on JAN 1, APR
1, JUL 1, and OCT 1:
# Determine if we need a full back. We do a full backup every three
months.
day=$(date +%d)
if [ "${day}" = "01" ];
then
month=$(date +%m)
case ${month} in
01|04|07|10)
full_backup=full
;;
*)
;;
esac
fi
if [ -n "${full_backup}" ]; then
echo "Performing a full backup"
fi
day=$(date +%d)
if [ "${day}" = "01" ];
then
month=$(date +%m)
case ${month} in
01|04|07|10)
full_backup=full
;;
*)
;;
esac
fi
if [ -n "${full_backup}" ]; then
echo "Performing a full backup"
fi
...
if ! duplicity ${full_backup} --allow-source-mismatch
${exclude_opts[@]} ${root_drive} <sftp options>;
then
echo "Failed to backup VM"
exit 1
fi
The code above is slightly different than "every 90 days" since the
script always performs a full backup on the 1st. Because the full
backup is always on the 1st, it is easy to find when it comes time for
a restore.
Jeff