Repository navigation
Description
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
BinsonBuzz commentedon Nov 12, 2018
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:
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:
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
iamjrock commentedon Nov 12, 2018
@BinsonBuzz, yes one of my earlier passes had that deletion, but I changed it after a comment from @ncw. It's a tradeoff:
I went for safer. But perhaps this should be a configurable option?
I see your point. I guess I was thinking:
xiaolei0125 commentedon Apr 22, 2019
@iamjrock Is there any new progress about unionfs?
iamjrock commentedon Apr 22, 2019
@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!
13 remaining items
trapexit commentedon Nov 8, 2019
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).
thestigma commentedon Nov 8, 2019
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 :)
Max-Sum commentedon Nov 30, 2019
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?
thestigma commentedon Nov 30, 2019
@ncw Likely wants to be informed on this. He can probably help you out on the specifics of merging back too I bet.
buengese commentedon Dec 2, 2019
@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).
ncw commentedon Dec 2, 2019
Seconded!
@buengese would you like to review the pull request when it comes in?
thestigma commentedon Dec 2, 2019
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 ^_^
iamjrock commentedon Dec 3, 2019
@Max-Sum, just wanted to say.....wow (!) and thank you for your work on this. Count me in as an enthusiastic tester as well!
harryqt commentedon Jun 24, 2020
I believe this issue can be closed now because Rclone now supports multiple writable backend.
ncw commentedon Jun 25, 2020
Well spotted @Dibbyo456 :-) Yes this is supported now, so will close.
Thanks @Max-Sum for your great work :-)