How would you create a merge of two filesystems, where one filesystem is always used except for a few selected files? #1202
Replies: 6 comments 29 replies
-
No, there is no file level choices to anything. You're the first person ever to ask for such a thing. At most people have asked about files matching some pattern. I still don't really understand what you mean by "active". If you combine things together they are expected that you want to use them. Otherwise why are you including them? Filesystems have a lot more functionality than creating or writing to a file. You have to explain at the function level what you want. Lots and lots of people combine multiple filesystems together (often local and remote) and have the remote effectively read only. That's the whole point of all the |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for explaining this. It sounds like I've had a different use case in mind though:
When you have a few files in a folder and you want to archive (move to the second remote) only a few of them this sounds like it won't work. You wouldn't want to move the whole folder neither.
I hoped that this can be integrated, because traversing many nested directories just to change remote sounds really tedious when done frequently.
I assumed that you can still see what files were archived (moved to a remote) in a directory and retrieve them when needed. If you move something completely you may never discover it again. Not really sure where to find a solution. You are right that I've never seen anyone merge filesystems and allow "file-level" control. I think that this would be really useful though. |
Beta Was this translation helpful? Give feedback.
-
There is no movement of any files currently. Your "problem" isn't unique to having two remotes. That's fundamentally the same as every other person using mergerfs with some smaller fixed size local storage and then some large/"unlimited" cloud storage. Probably thousands of people use mergerfs for that setup. That's why rclone added their union feature. But I still don't understand what you want from the software. A filesystem is made up of different functions. You have to speak about your expectations/requirements in that sense. You open a file... what happens. A file is created. What happens? An unlink is requested for "foo/bar/baz"... what happens? https://github.com/trapexit/mergerfs#terminology |
Beta Was this translation helpful? Give feedback.
-
A program asks the kernel to create a file, make a directory, whatever. That request is sent to mergerfs. mergerfs runs the policy you set for Of course it can decide on a file by file basis what to do. That's exactly what the policy does. But you need to articulate the algorithm to use. It doesn't magically know where you want files. It has to be able to determine it from the information it has. You have to tell me how you would decide how something would be placed on branch A vs B vs C. As I asked before... given what information do you make the choice? The file size? the name? the age of the directory? the time of day? ... f(x) = y... what is x? what is f(x)? |
Beta Was this translation helpful? Give feedback.
-
I want to expose mergefs via NFS, and only via NFS, and only that one mount. So the client has no idea that there are multiple branches "behind the scenes". So I ran into similar problems as @danielkrajnik So, the only way that could work is to have a script on the server, that will move specific files/folders based on defined rules from one dir(drive) to another. Not sure if this is really the most nice way. I would really wish a way to define a per-file/(sub)-folder policy, defined in a global config file. |
Beta Was this translation helpful? Give feedback.
-
Sometimes, it's simpler to ask for a solution rather than explaining the problem. But here we go: /mnt/cheap-archive --> Cheap to write and store, but very expensive and slow to read (for example, Google Archive Storage tier, or AWS Glacier).
/mnt/expensive-volatile --> Normal disk.
/mnt/merged --> Combines both. Now, I have these relative paths: ./media/movies --> Should always be placed into the "archive" branch.
./media/pictures --> Always on the "volatile" branch.
./media/disks/*.iso --> "Archive" branch.
./media/disks/readme.txt --> "Volatile" branch. This is only a "sample". What I mean is: There are dozens of situations where you have a "project folder" (somewhere deep in the tree), but you have mixed tiers: Volatile files like a "project index file", "project work file", and archive files, like untransformed raw data for the project, such as raw meshes, videos, etc. Without a detailed distinction, you always need to decide: "Do I put the whole project into the archive or the whole project into the volatile?". And of course, you also need to "expose" the underlining folders then...which I do not want! The client/consumer of mergefs should always be "unaware" and should never care about what is happening behind the scenes. Picking up files at intervals/moving them via a server script could work, but could cause conflicts if a file is being written at that exact moment - I'm not sure how mergefs would resolve this conflict. So, back to my so-called "solution", which I consider more of an idea or a concept of what mechanics could work: Having a config file with this content: ./media/movies archive
*.iso archive
* volatile Similar to a gitattribute file. So, what would happen if |
Beta Was this translation helpful? Give feedback.
-
I'm trying to merge two filesystems. One is "hot" and used every day, second one "cold" and used rarely only as an archive of large files.
You want to see both of them in one "tree" and I thought that you can use mergefs for that?
For example:
Would it be possible to have the "hot" filesystem always active? "Cold" filesystem would be then only used explicitly by the user for a few selected files?
I think that typically mergeFS follows a "policy" to decide where to write each file based on criteria (e.g. free space), but I'm wondering if it's possible to leave it to the user who would explicitly make that decision for each file (and mergefs would always write to one filesystem by default)?
Beta Was this translation helpful? Give feedback.
All reactions