Hello.
I have a question about restic “forget”.
I’ve set up a cronjob such that restic backs up my dropbox, some local folders, and an external hard drive (if it’s present). The snapshot is pushed to an s3 bucket.
Due to a lack of available ports my external hard drive is not always plugged in. Some snapshots will therefore not include the external HDD.
When the backup completes I run
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 7
and
restic prune
Am I right in my assumption that restic forget could pick all the snapshots that don’t have the HDD? Is there a more appropriate approach for this situation?
Cheers.
You are right. A better approach would be to make separate snapshots which only contain your external hard drive. This means your cronjob should run two restic backup
commands. Run the backup command to backup your external disc only if it is mounted, e.g. by checking /proc/mounts
.
1 Like
Thanks for coming back @alexweiss .
Just to be 100% clear. If my current command is:
restic backup "$DROPBOX" "$EXT_HDD" --verbose
you’re proposing I instead go for two sequential commands i.e.
restic backup "$DROPBOX" --verbose
if $EXT_HDD present: # pseudocode
restic backup "$EXT_HDD" --verbose
and that will avoid the danger of restic forget
killing $EXT_HDD
if it hasn’t been backed up in a long while?
That’s exactly what I am proposing
forget
will then apply the policy for each group of snapshots individually. Or you run two forget
runs with --path
specified.
A side remark: you can also run several backup
commands in parallel.
1 Like