Same preferences file used on 2 different devices (different storage URL)

I guess I oversaw an option:
my goal is to backup the same source to the same target but using different devices.

  1. device is linux which works with the storage path “/mnt/anything”
  2. device is windows with the storage path “S:\”

I just changed the path in the preference file and it worked.
But I have to change it manually every time the backups starts from a different device.
Can I add two different storage locations to the same storage in the preferences file?

It sounds like you want to back up a single source (S) to a single target (T) by running Duplicacy interchangeably from both a Linux and Windows device. Correct?

So you want to do the following in the preferences file?..

        "storage": "/mnt/anything",
        "storage": "S:\",
1 Like

Yes exactly.
Can I just add two different storages?
How will the backup react to this?

It won’t cause an error because the JSON format is a bunch of key/value pairs. However, because JSON parsing is linear starting from the first character in the file/stream until the last, only the final occurrence of “storage” will take precedence. Using my example above, it’ll seem as though Duplicacy is ignoring "storage": "/mnt/anything".

I think the only option is to assign different storage names. Assuming a fresh setup, the commands would be:

duplicacy init -storage-name Linux MySnapshotID /mnt/anything
duplicacy add Windows MySnapshotID S:\

The first command initializes the target and creates the preferences file, then the second command adds the additional storage.

The resulting preferences file will contain two storages (both pointing to the same target) and use the same snapshot ID (because the data source is the same).

On your Linux device the backup command would be duplicacy backup -storage Linux and on your Windows device it’d be duplicacy backup -storage Windows.

Be careful not to run backups in parallel on both your Linux and Windows devices because it’ll mess up the target.

I thought this is one of the main selling points of duplicacy that parallel backups can run.

It definitely is, but only when the snapshot IDs are different.

On the storage target, there are at least two directories and a config file at the root:

├── benchmark
├── chunks
├── config
└── snapshots

(Mine has 3 directories because I previously ran a benchmark test.)

Under the snapshots directory is one or more subdirectories, one per snapshot ID:

└── snapshots
    └── MySnapshotID

Each snapshot ID directory contains one or more compressed JSON files, one per revision:

└── snapshots
    └── MySnapshotID
        ├── 1
        └── 2

Each JSON file contains details about the backup including a manifest of the chunks required to restore the source files.

If your Linux and Windows devices run backups in parallel to the same target with the same snapshot ID, one of them could stomp on the other’s JSON file if they both happen to be creating the same revision.