Unionfs and rclone mount ?'s

Ok, I’ve never used unionfs before (never had a reason). I’m soundboarding here, explaining how I think this would work, and asking if I’m correct for those that know! Remember I’m a total unionfs noob…

So I have a folder here with TV shows:
/mnt/media/Series
And I have my encrypted amazon drive mounted here:
/mnt/acd/
the mount points to an amazon drive location of the shows here:
amazon: /crypt/Series

So when I ls in /mnt/acd I see:
/Series
/Movies

And so my full path to see my encrypted series is /mnt/acd/Series.

Now, what I want to do is union these two:
/mnt/media/Series
/mnt/acd/Series

First question: do I need a 3rd location to union to (my googling was vague)? Like /mnt/union/series? Or can I just say use /mnt/media/Series? I think I don’t need the 3rd location. I do understand when a file exist in both locations, you can tell it to use one or the other to run from. Like in this case I’d want it to use the local copy if it exist first.

Second question: I’m guessing once I do get this setup and working, I make sure I copy all my local content over to amazon, and delete my local content? and from then on when I want to move stuff to the cloud I just do a “rlcone move” … right?

Third question: Does this get around the file opened read/write at same time issue even if the file is in the cloud? Or does this just get around it till it get’s moved?

Help with correct mounting syntax would be helpful too. I’ve seen some on here but since I don’t know their original structure I’m not 100% on it.

Yes unionfs need the 3rd location eg where you will see merged folders
I would suggest you mount only root folders and not Series directly so you can drop inside folder Movies etc…
Example:

unionfs-fuse
-o cow,allow_other,auto_cache
/mnt/media/=RW:/mnt/acd/=RO
/mnt/unionfs

or in same line
unionfs-fuse -o cow,allow_other,auto_cache /mnt/media/=RW:/mnt/acd/=RO /mnt/unionfs

Bascially the above commands will show in /mnt/unionfs the content of both folders and when you copy new stuff in /mnt/unionfs it will be actually stored in /mnt/media that is marked as RW readwrite.

3 Likes

Ok, I ended up using this and it seems to be working correctly:
unionfs-fuse -o cow -allow_other /mnt/media/=RW:/mnt/acd/=RO /mnt/union/

is this correct usage for media servers? I have verified it writes new info written into /mnt/union/series into /mnt/media/Series. Since that’s my local drive, that’s what I want.

My only last two concerns are:

  1. Permissions. it seems the stuff coming from acd are -rw-r–r-- where I want -rw-rw-r–. I had to play with my rclone mount to get those permissions where I wanted them, but it’s not picking up the group or group permissions, only the owner. That could be a problem. Any ideas?

  2. So, once I get everything in sync, do I just do rclone moves on my local dir to keep it cleaned up? That should work right?

I had started writing the above post before you replied, but I adopted your suggestion. I hadn’t done it to begin with because my dir on local was Series and on acd series. In the end I was using this as a chance to get away from that stupid capital back from windows days. (I haven’t changed it because I’d have to go through and figure out what all has the capital path…aka TONS)

Anyway, I just changed it on acd, and now they match. So I didn’t get away from the capitals, but that’s ok, your idea was better all around.

Just make sure to set your rclone copy/move from /mnt/media as source.

Yep yep, roger that…

anyone get any ideas on permissions? Can’t seem to figure out permissions on the union directory. It’s not inheriting the groups or the rw permissions.

I see you recommend using the auto_cache option. Do you mind briefly explaining what that does?

I also noticed on your git page you recommend using the direct_io option. I read that this basically allows the file system to “cut and paste” files into the unionfs folder instead of copying a new file and then deleting the source. Is that assessment correct?