Sync from OneDrive to local?

Hi all! Registered to ask a question.

I’m running rclone as a docker in unRAID.

Sync the source to the destination, changing the destination only.

Rclone sync is set up by default to sync from local source to cloud destination, so the destination becomes a mirror of the source. In my case from unRAID to OneDrive.

Can I do the reverse? Have rclone sync OneDrive to unRAID?

That way I can drop files into OneDrive and also access them on my unRAID later.

Instead of “rclone sync $localpath $remotepath” use something like “rclone sync $remotepath $localpath”

1 Like

Thanks for replying.

I kinda did.

This is the default command in the rclone docker:

rclone sync /data $SYNC_DESTINATION:/$SYNC_DESTINATION_SUBPATH

where “/data” is the variable for the local source and “$SYNC_DESTINATION:/$SYNC_DESTINATION_SUBPATH” would be the variable for the cloud destination.

I tried flipping it around as you suggested

rclone sync $SYNC_DESTINATION:/$SYNC_DESTINATION_SUBPATH /data

but I got an error saying “directory not found” even though the default command worked in syncing across local and remote folder.

So I’m not sure what I’m doing wrong or if it’s possible.

Could it be hard coded into the docker to sync from local to remote and not the other way round?

That looks like the right syntax, though you don’t need the / in $SYNC_DESTINATION:/$SYNC_DESTINATION_SUBPATH

It should work just fine - I suspect some problem with your env variables, your config or maybe permissions…

1 Like

Hi @ncw, thanks for replying.

This is a snippet of the log I have:

2016/12/23 00:16:00 Local file system at /data: Waiting for checks to finish
2016/12/23 00:16:00 Local file system at /data: Waiting for transfers to finish
2016/12/23 00:16:00 Local file system at /data: not deleting files as there were IO errors
2016/12/23 00:16:00 Attempt 3/3 failed with 0 errors and: directory not found

2016/12/23 00:16:00 Failed to sync: directory not found 

The env variables and config ought to be right since I can sync from source to remote but now that you mention it, it might be permissions. The Docker might not have permissions to write to the folder I created on my unRAID. I’ll look into that, thanks for the suggestion!

If you run with -v then near the top of the logs you’ll see the parameters rclone got when run - check that those match what you think they should be.

1 Like

This is what I get when I run it with -v

Executing => rclone -v sync : /data
2017/02/01 19:19:00 rclone: Version "v1.35" starting with parameters ["rclone" "-v" "sync" ":" "/data"]

2017/02/01 19:19:00 Local file system at /data: Modify window is 1ns
2017/02/01 19:19:00 Local file system at /data: Waiting for checks to finish
2017/02/01 19:19:00 Local file system at /data: Waiting for transfers to finish
2017/02/01 19:19:00 Local file system at /data: not deleting files as there were IO errors
2017/02/01 19:19:00 Attempt 1/3 failed with 0 errors and: error listing source: Local file system at /config/:: directory not found

2017/02/01 19:19:00 Local file system at /data: Waiting for checks to finish
2017/02/01 19:19:00 Local file system at /data: Waiting for transfers to finish
2017/02/01 19:19:00 Local file system at /data: not deleting files as there were IO errors
2017/02/01 19:19:00 Attempt 2/3 failed with 0 errors and: error listing source: Local file system at /config/:: directory not found

2017/02/01 19:19:00 Local file system at /data: Waiting for checks to finish
2017/02/01 19:19:00 Local file system at /data: Waiting for transfers to finish
2017/02/01 19:19:00 Local file system at /data: not deleting files as there were IO errors
2017/02/01 19:19:00 Attempt 3/3 failed with 0 errors and: error listing source: Local file system at /config/:: directory not found

2017/02/01 19:19:00 Failed to sync: error listing source: Local file system at /config/:: directory not found

You need to use a remote name, not just a : so remote:.

Rather unexpectedly rclone is trying to read from a local directory called :!

Thanks for clarifying, not sure what happened there, if I copied it over the text wrongly or I used the wrong command!

I just tried running this command rclone -v sync remote:/Test/ /data:

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 40-config: executing...
crontab => * * * * * /app/rclone.sh
chmod: /config/Rclone.sh: No such file or directory
[cont-init.d] 40-config: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Executing => rclone -v sync remote:/Test/ /data
2017/02/02 22:56:00 rclone: Version "v1.35" starting with parameters ["rclone" "-v" "sync" "remote:/Test/" "/data"]

2017/02/02 22:56:01 remote: Saved new token in config file
2017/02/02 22:56:01 Local file system at /data: Modify window is 1s
2017/02/02 22:56:01 One drive root 'Test': Reading ""
2017/02/02 22:56:02 One drive root 'Test': Finished reading ""
2017/02/02 22:56:02 Local file system at /data: Waiting for checks to finish
2017/02/02 22:56:02 Local file system at /data: Waiting for transfers to finish
**2017/02/02 22:56:02 unraid-banner.png: Failed to copy: open /data/unraid-banner.png: read-only file system**

2017/02/02 22:56:02 Local file system at /data: not deleting files as there were IO errors
2017/02/02 22:56:02 Attempt 1/3 failed with 1 errors and: not deleting files as there were IO errors

So it looks like it’s reading the right folder “Test” on OneDrive, it sees the file unraid-banner.png. And subsequently runs into the read-only error.

I assume this means rclone or the docker it’s running as, doesn’t have write permissions to the local folder?

I then tried running rclone -v sync remote:/Test/ data and this actually kinda worked:

Executing => rclone -v sync remote:/Test/ data
2017/02/02 23:35:00 rclone: Version "v1.35" starting with parameters ["rclone" "-v" "sync" "remote:/Test/" "data"]

2017/02/02 23:35:01 Local file system at /config/data: Modify window is 1s
2017/02/02 23:35:01 One drive root 'Test': Reading ""
2017/02/02 23:35:01 One drive root 'Test': Finished reading ""
2017/02/02 23:35:01 Local file system at /config/data: Waiting for checks to finish
2017/02/02 23:35:01 Local file system at /config/data: Waiting for transfers to finish
2017/02/02 23:35:02 unraid-banner.png: Copied (new)
2017/02/02 23:35:02 Go routines at exit 7
2017/02/02 23:35:02 Waiting for deletions to finish
2017/02/02 23:35:02
Transferred: 87.364 kBytes (77.966 kBytes/s)
Errors: 0
Checks: 0
Transferred: 1

So some success! Except Rclone creates the folder “data” in Rclone’s config folder and the “unraid-banner.png” is copied, when I want it to go into a different folder I specified in the docker setup.

Managed to solve it, works fine now.

Turned out to be a permission problem, except I didn’t know where to look.

@ncw Thanks so much for your help and patience!

1 Like