All,
I have been told that Windows OneDrive client’s File-On-Demand cannot be implemented in rclone. Well, I found a workaround that seems to work. Not perfectly, but good enough.
The below is the configuration needed to implement File-On-Demand using a rclone mount. Since this is specifically set up and runs on RcloneView it has a batch job feature that would have to be scripted using pure rclone.
What is File-On-Demand. It is a mount that stores the files from network storage that have been used locally and keeps them synced and updated as long as the network storage is connected via a remote. All the files on the network storage is shown in the mount. To delete a file on the server you must delete it from the mount, but to remove the file from the local storage but keep it on the server you must delete it from the local storage directly. When the network storage is offline the mount will disconnect. At this point the only way to access the files is via the local storage folder.
Included is a batch job that emulates a partial bisync. All local files are synced with the network files, but the network files are only synced with existing local files (else you would get the entire network storage stored on your hard drive).
This is not perfect, it does not properly detect some offline deletions, name changes, and moves. It would take a dedicated network storage client to get this totally correct, but it seems to be working good enough for me.
Implementation includes two Union Virtual Remotes, a Mount, and a two step Job Batch. This can easily be adapted to use more than one network storage in the unions, all kept in sync for storage redundancy (this will need adding steps to the job batch though). It can also be easily adapted to use Crypt Virtual Remotes to provide local file encryption. It can use any type of remote supported by rclone as sources and destinations.
Good luck and enjoy. A list of how to configure follows. Any property/argument not listed use the default. I set it up kind of like a configuration file.
[Union.Drive]
### File-On-Demand front end union for use with the mount
type = union
upstream0 = remote0:/optPath:writeback
upstream1 = remote1:/optPath
action_policy = all
create_policy = all
search_policy = ff
[My.Mount]
### mount implementing File-On-Demand
type = mount # or cmount for Windows
remote = Union.Drive:/optPath
target = /path/to/mount/point
volume-name = My.Mount
cache-mode = full
cache-max-size = 1.00 GB # adjust as needed
cache-max-age = 30 seconds # needs to be short in order to detect remote side changes quickly
dir-cache-time = 15 seconds # needs to be short in order to detect remote side changes quickly
[Union.Sync]
### File-On-Demand back end union for use with batch job(s)
type = union
upstream0 = remote0:/optPath:nc
upstream1 = remote1:/optPath:ro
action_policy = epall
create_policy = epmfs
search_policy = ff
[Job.Sync]
### Batch job ran on a schedule to implement the backend for File-On-Demand.
type = batch-job
schedule = 10 minutes # adjust on how often you want the backend updated.
{
[Step 1]
### this step copies the previously used files in local storage back to the network storage if
### they are newer than the network storage files or if not on the network storage
command = copy
source = /Path/To/Local/Storage
destination = RemoteName:/optPath
[Step 2]
### this step copies the network storage files back to the local storage if they are newer than
### the local storage files. They do NOT copy the files if not already on the local storage.
command = copy
source = RemoteName:/optPath
destination = Union.Sync:/optPath
}
Thank you
Jeff Y.