How to back up folder/files within the MacOS Library folder

The MacOS Library folder contains a lot of data worth to be backed up regularly.

However when backing up this folder I get a varying set of warnings every time, that I loose oversight what’s important and what can be ignored. One reason to my understanding is that Duplicati does not use APFS snapshots as it uses VSS on Windows and therefore I get warnings for files in use.

So the idea was to use filters for the folders I want to backup. However whatever I try, either the whole Library or nothing gets selected in the GUI.

For example trying to include the “Mobile Documents” folder and excluding every thing else does not work with the below filters (I tries other variants without success).

+%HOME%/Library/Mobile Documents/
-[.%HOME%/Library/[^/]*]

Any help would be appreciated,

Heinz

I don’t have a Mac, but maybe someone who uses one will come by to say what they do.

What Duplicati version? 2.1 changes default behavior, but I think it follows .NET change.

  --ignore-advisory-locking (Boolean): Ignore advisory locking
    When reading files Duplicati can skip files that are marked locked by
    another application to ensure consistency. This flag can disable the
    check and perform optimistic reads of locked files.
    * default value: false

can be set if you like how 2.0.8.1 did it (which risks getting inconsistent files, but APFS snapshots risk that too I think – it’s not like VSS which works with applications to flush).

If you prefer to pursue the Filters in Duplicati route, please read there, and you can use The TEST-FILTERS command to test. There are help & test sites, e.g. REGEX STORM where you can see if your regex seems about right. For posting here, please add three backticks on lines above and below your filters. The regex you show looks kind of odd, however you might have been trying to avoid forum formatting by adding backslashes until it was better.

This should be as easy as selecting the desired folder without any Filters, but it might not be what you really want. I’m not clear what you really want, beyond it’s selected folders… Selecting more than one folder in the Source tree is also possible. One can also deselect subfolders below a selected folder by clicking on the subfolder to auto-produce that Filter.

I found a solution after some more tinkering:

-%HOME%/Library/Mobile Documents/.Trash/
+%HOME%/Library/Mobile Documents/
+%HOME%/Library/Mobile Documents/**/

-*%HOME%/Library/**/

Not sure I understand the logic in detail, but this excludes everything except the “Mobile Documents” Folder

I solved these problems by using APFS snapshots. This allows me to back up essentially the entirety of /Users and /Library. I wrote a bash script to create and mount the snapshot and plug in the script with --run-script-before-required and clean it up with a --run-script-after. With the snapshot mounted at /private/tmp/snap, my backups are actually backing up, e.g., /private/tmp/snap/Users, but the data is there. I still get occasional groups of errors because of permissions problems on the Spotlight indexes, despite the documentation claiming ACLs aren’t respected on mounted snapshots. NOTE: I also replace the plist file for the server so the server can run as root and not an individual user, but I don’t think that’s necessarily a requirement for snapshots. It does take some tinkering with security settings: Duplicati needs full disk access, and current versions of MacOS try hard to not let you mount snapshots because ACLs aren’t respected.

Overall this is running stably for me, but feels like you have to be a pretty competent system administrator to get it set up. I’m happy to share scripts and plist files if anyone wants them, but honestly that was the easy part compared to getting the system security correctly configured.

I tried the option –snapshot-policy = required but that gives this error:

An error occurred trying to start process '/Applications/Duplicati.app/Contents/MacOS/lvm-scripts/find-volume.sh' with working directory '/'

Perhaps I need to borrow your scripts @madfordmac

As new Duplicati user on MacOS the experience feels a bit rough so far. Opened a new thread with some examples here.