brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: borg create --list --filter=AME shows only new, changed and unreadable files

Linux
~/tips/tip-backup-borg-create-list-filter

borg create --list --filter=AME /path/to/repo::{hostname}-{now} ~/Documents

Lists only the added, modified and unreadable files in a Borg backup run.

By default borg create says little about what it did. With --list it prints every file, but a full list is far too long. Add --filter and you only see the files that matter.

borg create --list --filter=AME /path/to/repo::{hostname}-{now} ~/Documents

Each listed item starts with a status character. The ones from the docs are A for a regular file that was added, M for a modified regular file, U for an unchanged one, and E when an error happened while accessing or reading that file. --filter=AME keeps the first, second and last kind, so you see what changed in this run plus anything that could not be read, and the long tail of unchanged files stays out of the log.

I like this for a cron job whose output goes to a log file. A line starting with E is a file that was not backed up, which is exactly the thing you want to notice. For a first run, A will list everything, so use it on a small folder to see how it looks.

Two more options in the same family help when you test a new job. --dry-run (-n) does not create an archive, and --stats prints statistics for the archive that was created. They are handy when you test a new job for the first time.

The caveat is that the filter only changes what is printed, not what is backed up. An E line means that one file was not read, so look at its permissions or whether something else holds it open before you trust the archive. Also note that the repo::archive syntax above is the Borg 1.x form from the stable docs.

Further reading: Borg docs: borg create

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link