I need to set up a network fs, so that I can mount a directory from Box A on to Box B and Box C. However, I need those files to not be transferred from Box A upon every access request; basically, I need the files cached locally, and only updated when "pushed" from Box A.

Any suggestions?


You might benefit from using NFS and CacheFS. It should be available on most modern Linux distros.

  • Interesting. I'll have to look in to CacheFS; it might be exactly what I need. – Glen Solsberry Feb 15 '11 at 17:41

You can serve the files over FTP, HTTP(S) or SFTP, and access them through LftpFS.

lftpfs --options=ro,allow_other --fs-cache-timeout=999999999 /net/A /var/cache/net/A /etc/local/A.lftp

where /etc/local/A.ftp contains something like

open sftp://A/shared
  • Does that cache the files/data somehow on each machine? – Glen Solsberry Feb 16 '11 at 13:31
  • @gms8994: Yes, files are cached for 999999999 seconds under /var/cache/net/A. – Gilles Feb 16 '11 at 20:35
  • What about changes to the source file? How are those propagated? If this is all explained in the help, let me know, and I'll quit bugging you. I just want to make sure everything is handled as necessary... – Glen Solsberry Feb 16 '11 at 21:49
  • @gms8994: I can't find anything in the documentation. Looking at the source, there seem to be cases where it'll compare the cached file's size and mtime with the upstream file, but I'm not sure if that's always done. – Gilles Feb 16 '11 at 21:59

Can you run rsync on Box A whenever you need to push the files to the other 2 boxes?

Something like:

rsync -avz /local/directory/ boxb:/remote/directory/
rsync -avz /local/directory/ boxc:/remote/directory/

rsync will only copy changed files as required.

If you need to automate the push, you could always use cron to start the rsyncs.

  • I could, in the strictest sense of the word, but this isn't real-time enough for my coworkers; they want to see stuff they upload as soon as they upload it. This + load-balancing makes for difficulties. – Glen Solsberry Feb 15 '11 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.