Duplicati and disk (auto)mounting conflicts

I’ve run into a problem with setting up Duplicati. This particular system has to do two backups: one to a local external disk and one to a remote S3-compatible location. The problem I have is with the local external disk.

This is on a Mac, but I suspect one cold create comparable scenarios on other unix-like systems. On the Mac in question, the disk is not always available. When it is turned on, it automounts and appears in the /Volumes directory. E.g. a partition called “Backup” will be mounted on directory “/Volumes/Backup”.

Duplicati runs permanently as server and has two backup sets. One backing up to a remote S3-compatible site and the other on the local disk in directory “/Volumes/Backup/Duplicati”

But what happens with the local backup when the disk is ejected / turned off or (as this is a laptop) the disk just isn’t attached? Duplicati wants to backup in directory “/Volumes/Backup/Duplicati”. That directory does not exist and Duplicati simply creates it. Hence, a real directory "/Volumes/Backup"is created (and inside a directory “Duplicati”). After which Duplicati fails, because that directory is empty and it doesn’t contain any files so it doesn’t fit with the database. Repairing the database does not help. Duplicati reports “No filelist found on the remote destination” and rightly so.

It gets worse, because what happens now when the disk is attached and it mounts? macOS notices that there now is a directory “/Volumes/Backup” (created by Duplicati on the root disk) and hence decides to mount the disk as “/Volumes/Backup 1/” instead. Duplicati still looks for /Volumes/Backup" (which now exists on the root disk and is empty) so it never sees the actual backup. It also cannot repair either, as it looks for another directory altogether. Or, in other words, Duplicati (on the Mac at least) is not robust under non-permanently available locations.

Now, I cannot solve this by starting the server in another way. Because suppose I would start the server and configure the startup such that Duplicati only runs when /Volumes/Backup exists, it would mean the S3-compatible backup will not run unless the local disk is available (actually the directory exists).

So, what is needed is a switch at he level of the backup set that it should not create its root directory if it doesn’t exist but just fail (with an informational/warning message). A switch at the server level could work, if I could tell the server not to create a backup if it is not already there (but we would have a chicken-egg scenario). The fact that Duplicati creates this directory if it is missing creates havoc in this scenario.

Question: is there a way with current Duplicati flags to get the behaviour I want (do not create a parent directory for a backup if it isn’t already there yet)? If not, then this is a feature request.

See MacOS USB destination confusion