1

Currently I have Borg archives being creative hourly, via a cron script, for directories I'd like to be backed up. However, this is not exactly ideal. Ideally, I'd like backups to be created more than hourly while that portion of the filesystem is active. Conversely, sometimes one of the directories might stay unchanged for weeks at a time - so, creating hourly archives is just a waste of space, and I don't want to be manually switching portions off or on all the time.

From what I've been able to search, linux does not really have any robust system for continuous backups. If this conclusion is erroneous, then please do point me in the right direction.

But if that is true, I'd like to do the next best thing - have an archive only be created if a file has changed (i.e., checksums on the live filesystem do not match those of files in the archive... ideally).

Is there a way that a script, program option, or some other method can accomplish this?

Thank you.

3
  • Have you enabled deduplication? Feb 19 at 16:39
  • Yes. But the repo's size still grows from running hourly backups constantly.
    – Beep13
    Feb 19 at 23:32
  • @Beep13 I'd expect the backup archive to grow, even when no file has been updated or added. However, that growth can't be very large, can it? It's just metadata describing the fact that nothing changed. I'm using restic to take hourly backups of five (very different) machines at home (from the root down, everything), and in two years I'm using about 300 GB. I'm pruning backup snapshots by only keeping the most N recent hourly, daily, weekly, monthly backups, obviously.
    – they
    Feb 27 at 9:54

2 Answers 2

0

Try --files-cache ctime,size to ignore inode and see if the deduplicating works now. On some mounting devices as sshfs or some others, inodes change on each mounting so it should ignore they. More information in man borg-create.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Mar 5 at 1:16
0

Borg does de-duplication (only copies new data), so this isn't strictly necessary, but I agree that unwanted backups can add clutter to borg list.

This script will find the most recent file in the folder, get it's parent folder and compare that to the borg backup directory.

folder='<your folder to recurse'
bak='<your borg backup directory>'

recent="`find "$folder" "$bak" -type f -printf '%T+ %p\n'| sort -n | tail -n1 | awk '{ print $2 }'`"
echo "Most recent file: $recent"
if [[ "`dirname $recent`" == "$bak" ]]; then
    echo "Archive is Up to date!"
else
    echo "Ready to run Borg Backup..."
    # >>>Insert borg backup command here<<<
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.