You are not logged in.

#1 2019-01-10 02:36:27

Stratoblaster
Member
Registered: 2018-12-04
Posts: 35

[SOLVED] Offline files

Hello -

Is it possible to enable some sort of offline files from a network share? If so, please point me to a resource.
I did a quick look and I did see at some point there was/is something called cachefilesd that seemed to do that.
Anyhow - if anyone can simply point me in the direction of resources, I'll managed the rest.

my Arch system accesses a Linux samba server and works very well. Would be nice to have files offline when I need to travel without the need to just copy the whole document tree (or even just several files).

Thanks
SB

Last edited by Stratoblaster (2019-01-10 15:29:40)

Offline

#2 2019-01-10 03:31:09

dmartins
Member
Registered: 2006-09-23
Posts: 360

Re: [SOLVED] Offline files

There seem to be a few solutions around although I haven't found one that looks actively maintained.
catfs seems to be the most recently updated. Its page references a few others at the bottom: https://github.com/kahing/catfs/

I've always had good luck with unison for doing on demand, bidirectional synchronization of directories

Offline

#3 2019-01-10 13:01:33

Stratoblaster
Member
Registered: 2018-12-04
Posts: 35

Re: [SOLVED] Offline files

Thanks for the reply!

I looked into this and its not a bad option (not great) but it is an option.
Interestingly, I had to download and compile the beta code for my Debian server since the version in the  Arch repo is newer than what is available
in a Deb package for stable (make sense).

That being said, at first glance, it does not appear to be much different than using rsync (guessing). So now of course is to use it on-demand or script/cron it.
Seems like a lot of overhead to cron it for like every hour or two especially if most of the files are not accessed but maybe once or twice a day (in most cases).
I do like the fact that it is bi-directional (that means less tinkering/scripting/etc) as that is a big plus.

Still - it has grown on me since last night. I'm going to look around for other options that may work but this for now, works.

SB

Last edited by Stratoblaster (2019-01-10 13:06:16)

Offline

#4 2019-01-10 14:50:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,109
Website

Re: [SOLVED] Offline files

It sounds like you might like a inotify-based script.  Just set up an inotify watch to trigger an incremental rsync (or even trigger this catfs if you want to stick with that).

This way only what needs to be synced will be synced, and only when it needs to be.

But note that a systemd timer or cron job has very little overhead for the scheduling itself.  And assuming you are using a reasonable rsync command, it will quickly note that there have been no changes and exit without doing anything more.

Last edited by Trilby (2019-01-10 14:51:13)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2019-01-10 15:28:26

Stratoblaster
Member
Registered: 2018-12-04
Posts: 35

Re: [SOLVED] Offline files

Thanks for that, Trilby!
I indeed have my homework for the weekend!

Ill go ahead mark this solved/resolved.


SB

UPDATE:
inotify does not support recursively watching directories, meaning that a separate inotify watch must be created for every subdirectory.

Arrrrrrrghh ... that can't be!!!!


Ahhhh, wait... inotifywait, Hmmmm

Last edited by Stratoblaster (2019-01-10 16:44:48)

Offline

#6 2019-01-10 19:42:40

Stratoblaster
Member
Registered: 2018-12-04
Posts: 35

Re: [SOLVED] Offline files

Still a work in progress but I did some quick messing around and this is what I came up with (for those that might want to play a bit).
It's crude and not fully implemented, but it does accomplish what I would like it to.
If anyone feels the erg to streamline/cleanup/etc the following, I am very much open to other ways to frame this process.

After installing inotify-tools, I use inotifywait (because of the ability to monitor directories recursively).
I create an ssh key on the local system then copy it over to the server. As you all know, this will allow key access opposed to using a password.

Here's the script I threw together. I put a sleep in there so that the sync does not happen right away. Of course that can be removed, shortened or lengthened.
The only thing I have yet to do was to launch it automagically either on login or some other way. So for testing purposes, I just launch it as I go.

#!/bin/sh
while inotifywait -r -e create -e delete -e modify /home/sb/Documents;
 do notify-send "Documents have been changed...";
sleep 120;
rsync -avze ssh /home/sb/Documents/ sb@tomcat:/media/Data/Users/sb/;
 notify-send "Synchronising documents...";
done

Last edited by Stratoblaster (2019-01-10 19:45:42)

Offline

#7 2019-01-10 19:53:25

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 26,865
Website

Re: [SOLVED] Offline files

You should look at syncthing...


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#8 2019-01-10 22:02:16

fukawi2
Forum Moderator
From: .vic.au
Registered: 2007-09-28
Posts: 5,630
Website

Re: [SOLVED] Offline files

Stratoblaster wrote:

inotify does not support recursively watching directories, meaning that a separate inotify watch must be created for every subdirectory.

I have a project that supports creating recursive inotify watches, but would need a feature patch to execute a sync script as an action (it's definitely still beta at this stage, but working so far): http://fscanary.info

Offline

#9 2019-01-10 23:17:30

Stratoblaster
Member
Registered: 2018-12-04
Posts: 35

Re: [SOLVED] Offline files

@jasonwryan - This looks interesting! Thank you for that!

@fukawi2 - Thanks for that also. I'll keep an eye out for this also!!

Thanks everyone. No need to keep this thread alive.

SB

Offline

Board footer

Powered by FluxBB