Use of two google drive accounts

Is it possible to use two google drive accounts to perform two backups (with different set of files) from the same repository? Something like gcd1 and gcd2.

I know you can do that with the command line version but not with the gui.

You can back up to two different google drive accounts from the same repository by create two different storages… However, what is problematic is that you can back up a different set of files for each storage as of now. That would require a -filter option we just mentioned in the other thread which would allow you to specify a different set of include/exclude patterns for each backup.

Ok, so let’s try another approach: two different repositories, each on backed up to a different google drive account.

My current preferences file (one repository, one google drive account) looks like this:

        "name": "gcd",
        "id": "NOTE_Admin_DB1",
        "storage": "gcd://NOTE_Admin_DB1",
        "encrypted": true,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "keys": null

I should them create (init) two sets of preferences by running different init commands in each repository, each one with a different json token file:

duplicacy init rep_id_1 gcd1:rep_id_1

and

duplicacy init rep_id_2 gcd2:rep_id_2

And would the preference files look like this?

        "name": "gcd1",
        "id": "NOTE_Admin_DB1",
        "storage": "gcd1://NOTE_Admin_DB1",
         ...
        "name": "gcd2",
        "id": "NOTE_Admin_DB2",
        "storage": "gcd2://NOTE_Admin_DB2",
         ...

Is this correct?

@towerbr
Yes, that will work. F.i. at the moment I do have one backup at the root of my D: drive with a storage on an external HD.

On the same drive I have a subfolder for projects and it contains another initialized backup with different storages (actually it has the same external HD and in addition OneDrive as a second storage).

That can work but you can also put them in the same repository if they can share the same filters file:

cd /path/to/repository
duplicacy init gcd1 gcd://NOTE_Admin_DB1    # repository id: gcd1, storage: default
duplicacy backup  # back up to the default storage

duplicacy add gcd2 gcd2 gcd://NOTE_Admin_DB2 # repository id: gcd2, storege: gcd2
duplicacy backup -storage gcd2 # back up to the gcd2 storage

Thank you, Nelvin and Gilbert. I’ll try these settings.

Well, due to the errors I’m having with Dropbox (see this issue), I’m redirecting some of my backups to Google Drive.

I already had a Google Drive account configured and working, but I decided to migrate to another account with more resources.

The preferences file of the current configuration looks like this:

        "name": "gcd",
        "id": "DBE",
        "storage": "gcd://DBE",
        "encrypted": true,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "keys": null

I deleted the backup from the first google drive, removed the preference files and I’m trying to initialize the repository to the new Google Drive account. But when I try the command:

duplicacy init -e -pref-dir d:\centralized_prefs\DBE rep_id gcd://Duplicacy/DBE

it “looks for” the folder on the old Google Drive account. What do I have to do to refer to the new account?

When I try:

duplicacy init -e -pref-dir d:\centralized_prefs\DBE rep_id gcd2://Duplicacy/DBE

it obviously does not recognize ‘gcd2’ as the type of storage.

What am I doing wrong?

Try to edit the preferences file to change to the name from gcd to gcd2. This is because this name is used as part of the key name when retrieving the password (in this case the gcd token file) from KeyChain on macOS or the keyring file on Windows, and you may already have the token file for your first Google Drive account stored there. By changing the preference name you will be prompted to enter the token file path for your second Google Drive account.

I think I don’t understood very well.

I’m using a centralized folder for preferences:

\centralized_prefs
└── my…
└── myprojects
└── DBE
└── my…

“my projects” backs up to the first google drive account.

I want that “DBE” backs up to the second google drive account. DBE was backing up to the first one.

I deleted the “.duplicacy” file in the DBE repository and the related subfolder in the centralized preferences folder. So there’s nothing to “tell” Duplicacy that the files from that repository were someday copied somewhere, right?

I ran the init command:

duplicacy init -e -pref-dir d:\centralized_prefs\DBE DBE gcd://Duplicacy/DBE

It created the “.duplicacy” file in the repository and the corresponding subfolder in the centralized preferences folder.

In the subfolder only the preferences file was created with the following content:

    "name": "default",
        "id": "DBE",
        "storage": "gcd://Duplicacy/DBE",
        "encrypted": true,
        "no_backup": false,
        "no_restore": false,
        "no_save_password": false,
        "keys": null

The keyring file was not created.

It didn’t ask for the new token file (which I’ve already downloaded).

(Remembering the “my projects” repository is still there, and refers to the first “gcd”, but does Duplicacy “see” that other subfolder?)


When I try:

duplicacy backup -storage gcd://Duplicacy/DBE 

It returns:

No storage named 'gcd://Duplicacy/DBE' is found

(so far the keyring file was not created, and it looks like it looks for this /Duplicacy/DBE in the first google drive account, and that folder does not really exist there anymore)


So I try to change only the name:

"name": "gcd2",
"id": "DBE",
"storage": "gcd://Duplicacy/DBE",

And try:

duplicacy -backup -storage gcd2://Duplicacy/DBE

It returns:

No storage named 'gcd2://Duplicacy/DBE' is found

So I try to change the name AND the storage:

"name": "gcd2",
"id": "DBE",
"storage": "gcd2://Duplicacy/DBE",

And try:

duplicacy -backup -storage gcd2://Duplicacy/DBE

It returns the same:

No storage named 'gcd2://Duplicacy/DBE' is found

The “keyring” file and the “cache” folder were not created within the new subfolder, just the “preferences” file.

Is Duplicacy finding the “keyring” of the first Google Drive account in another subfolder?

duplicacy init -e -pref-dir d:\centralized_prefs\DBE DBE gcd://Duplicacy/DBE

If this command doesn’t ask you for a gcd token file nor does it create a keyring file under d:\centralized_prefs\DBE then you must have set it in the environment variable DUPLICACY_GCD_TOKEN (assuming you’re running Windows).

duplicacy -backup -storage gcd2://Duplicacy/DBE

Should be:

duplicacy -backup -storage gcd2
1 Like

…then you must have set it in the environment variable…

That was it! It was in my password repository…

Thanks! Now everything is working perfectly.

Gilbert, as I said in another thread, my backups are running perfectly, but I think I have not yet fully mastered the init command.

Even on the subject of this topic here, I ended up not running on two google drive accounts, but migrating from one to another.

So, I would like to ask you, when you have a time (no hurry), clarify how to do the following setup (from scratch), “filling in” the command arguments and how the configuration files would look. Feel free to change the commands and / or order of execution:


Objective: two folders, each one backing up to a different Google Drive account:

d:\folder1 -> Google Drive account 1 - remote folder \Duplicacy\folder1bkp

d:\folder2 -> Google Drive account 2 - remote folder\Duplicacy\folder2bkp

Steps:

  1. Run init command in folder 1:

duplicacy init -e ___________ ______________

The generated preferences file will look like this:

"name": "______",
"id": "______",
"storage": "_______",
...
  1. To reference the token file set up an environment variable:

DUPLICACY_ ____________ _GCD_TOKEN

or add/edit the following line in the preferences file:

"keys": __________

  1. Run init command in folder 2:

duplicacy init -e ___________ ______________

The generated preferences file will look like this:

"name": "______",
"id": "______",
"storage": "_______",
...
  1. To reference the token file set up an environment variable:

DUPLICACY_ ____________ _GCD_TOKEN

or add/edit the following line in the preferences file:

"keys": __________

  1. To perform the backup of folder 1 use the command:

duplicacy backup -storage ____________

  1. To perform the backup of folder 2 use the command:

duplicacy backup -storage ____________

I’ll create a new wiki page using your post as a template.

The wiki page is now ready: Multiple repositories on the same cloud storage service but with different accounts

Thanks!

Now I understand the “secret”: I must use -storage-name, not -storage… The other syntax details are also interesting.

The “Restore to a different folder or computer” page is very good too.

I also noticed the modifications on the init page

Nice work!