Skip to content

rclone union mount allow more than one writeable remote #2737

Closed

Description

@iamjrock

Output of rclone version

v1.44, however this is a request for a new feature.

Describe the issue

This feature request has been discussed at length here.

rclone union mounts currently have the restriction that only the last remote can be written to (all other remotes are read-only). If we can remove this restriction then many rclone users who currently deploy unionfs or mergerfs could instead consolidate down to just using an rclone union mount. This is especially helpful for Windows/OSX users as there are no readily available union filesystem solutions like unionfs/mergerfs for these operating systems.

Whilst removing the read-only restriction would accommodate many scenarios, the very common use case that we would like to achieve is:

  • location-0 is a local temporary folder and has the highest read priority. location-1 is a cloud remote with most of our storage.
  • New files: When our local apps create new files, they are written to location-0 without any latency.
  • Moved/Renamed files:
    -- If the original file exists only on location-0: just mv within location-0
    -- If the original file exists only on location-1: just move (server-side) the file in location-1
    -- If the original filename exists in both locations: mv the file in both locations (server-side mv for location-1).
  • Updated files: If the file is opened and saved, or replaced with a file of a larger/smaller size (same filename):
    -- If the original file exists only in location-0: just overwrite the original file in location-0
    -- If the original file exists only in location-1: leave the old file in location-1 and write the new file to location-0
    -- If the original file exists in both locations: leave the old file in location-1 and overwrite the old file with the new file in location-0.
  • Deleted files: Delete from both locations.

This would then be cleaned up periodically with the following commands:

  • rclone move any file from location-0 to location-1 that is not identical (filename, subfolder, size) in both locations; then
  • delete any remaining files left over in location-0 (these are probably files that have the same filename and size in both remotes).

This periodic cleanup could be managed separately from this feature request, or included as union mount functionality.

The rclone forum thread also discusses various rclone.conf schemes that might be used to define the behaviour.

Activity

  1. BinsonBuzz commented on Nov 12, 2018

    @BinsonBuzz

    Edit: Ignore below - just re-read @ncw comment in thread about letting rclone move remove the duplicate

    Thanks for getting this going. A few questions/edits:

    -- If the original file exists only in location-1: leave the old file in location-1 and write the new file to location-0
    -- If the original file exists in both locations: leave the old file in location-1 and overwrite the old file with the new file in location-0.

    Shouldn't that be delete the old file in location-1 and write new file to location-0? I'd rather avoid situations where I end up with duplicate files

    Similarly:

    rclone move any file from location-0 to location-1 that is not identical (filename, subfolder, size) in both locations; then

    I'd rather it was move all files from location-0 (subject to any exclusions --exclude) including identical ones as I think rclone will just overwrite the old location-1 version, so I don't end up with duplicate files

  2. added this to the v1.46 milestone on Nov 12, 2018
  3. iamjrock commented on Nov 12, 2018

    @iamjrock
    Author

    I'd rather avoid situations where I end up with duplicate files

    @BinsonBuzz, yes one of my earlier passes had that deletion, but I changed it after a comment from @ncw. It's a tradeoff:

    • Cleaner: Deleting from location-1 in these situations is "cleaner" in that there is no need to handle the overwrite of old versions in location-0 during the periodic move operation; vs
    • Safer: Not deleting is "safer" in that the old file is still in location-1 until it is explicitly replaced later. Like having a Trash can...

    I went for safer. But perhaps this should be a configurable option?

    including identical ones

    I see your point. I guess I was thinking:

    • Less bandwidth is used if identical files are automatically excluded from the move; and
    • In my setup I can't always use an --exclude as I often don't know the name of the files in advance of the move.
  4. modified the milestones: v1.46, v1.47 on Feb 9, 2019
  5. modified the milestones: v1.47, v1.48 on Apr 15, 2019
  6. xiaolei0125 commented on Apr 22, 2019

    @xiaolei0125

    @iamjrock Is there any new progress about unionfs?

  7. iamjrock commented on Apr 22, 2019

    @iamjrock
    Author

    @xiaolei0125, nothing from my end. Sadly I haven't been able to help with rclone in the past few months. However I can see above that last week @ncw moved this enhancement request into the v1.48 milestone, so fingers crossed for v1.48!

  8. modified the milestones: v1.48, v1.49 on Jun 19, 2019
  9. modified the milestones: v1.49, v1.50 on Aug 27, 2019
  10. 13 remaining items

  11. trapexit commented on Nov 8, 2019

    @trapexit

    The reason mergerfs doesn't work on OSX is because there are very few people who are looking to use their Mac as a data store. It's a desktop OS. There has been some interest but I don't have a Mac and no one has stepped up to port it. There are enough differences between FUSE implementations and general OS behaviors to make it more than a quick thing.

    Trying to make rclone present different backends as a POSIX filesystem is extremely non-trivial. They aren't designed for that. Also, a unionfs has to do more than make it look like a couple directories are really one. And a union of a posix filesystem is not the same as the union of a bunch of cloud services (all with slightly different features and APIs).

  12. thestigma commented on Nov 8, 2019

    @thestigma
    Contributor

    I agree that Union should largely seek to emulate mergerFS in terms of the basic functionality. There has been a long long thread on this already, and the proposals here including my own basically sum up the main points of that consensus. Having it be part of rclone also offers up some unique possibilities in terms of integration. Also - as has been stated many times - it would be massively helpful to have a robust option outside of Linux. There exist options that simply "merge folders" but Union needs to do more than just this and I don't know of any proper replacement for mergerFS on Windows at least.

    NCW has indicated he may take a look at this topic for one of the next two versions.

    The best stop-gap solution so far has been to run mergerFS on windows via WSL2 (Linux-on-Windows). That is actually quite workable and practical due to the very tight integration and easy file-sharing, so running your whole rclone backend from the Linux environment does work. it's not exactly user-friendly though, and it leaves no room to optimize or add specifically rclone-related features as mergerFS is meant for generic use and not cloud. It works pretty well, but it's ultimately just a convoluted workaround.

    @ncw When you get around to working on this, I think there are several people here very keen on being part of early BETA'ing for the feature to give feedback, find weaknesses and bounce ideas. I certainly volunteer :)

  13. Max-Sum commented on Nov 30, 2019

    @Max-Sum
    Contributor

    I have implemented a multiwrite union on Max-Sum/rclone. It is inspired by the policy design of mergerfs. Could anyone help me to merge back?

  14. thestigma commented on Nov 30, 2019

    @thestigma
    Contributor

    @ncw Likely wants to be informed on this. He can probably help you out on the specifics of merging back too I bet.

  15. buengese commented on Dec 2, 2019

    @buengese
    Member

    @Max-Sum this looks very good. Could open a pull request with this? This seems to check pretty much all the boxes and also supersedes my work on mirror backend I think (which is great because i never seem to find the time to finish it).

  16. ncw commented on Dec 2, 2019

    @ncw
    Member

    @Max-Sum this looks very good. Could open a pull request with this?

    Seconded!

    This seems to check pretty much all the boxes and also supersedes my work on mirror backend I think (which is great because i never seem to find the time to finish it).

    @buengese would you like to review the pull request when it comes in?

  17. thestigma commented on Dec 2, 2019

    @thestigma
    Contributor

    I will be very happy to help betatest this if you need some lab-rats. (and probably others here as well)
    Just give me a holler and I'll come running ^_^

  18. iamjrock commented on Dec 3, 2019

    @iamjrock
    Author

    @Max-Sum, just wanted to say.....wow (!) and thank you for your work on this. Count me in as an enthusiastic tester as well!

  19. modified the milestones: v1.51, v1.52 on Feb 1, 2020
  20. modified the milestones: v1.52, v1.53 on May 29, 2020
  21. harryqt commented on Jun 24, 2020

    @harryqt
    Contributor

    I believe this issue can be closed now because Rclone now supports multiple writable backend.

  22. ncw commented on Jun 25, 2020

    @ncw
    Member

    Well spotted @Dibbyo456 :-) Yes this is supported now, so will close.

    Thanks @Max-Sum for your great work :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions