4

I want to work from home via SSH.

I run Ubuntu. I have installed sshfs and mounted my files locally. However, working on local files is too slow, as sshfs fetches files each time it wants to read it.

How can I put everything into cache ?

user877329
  • 6,717
  • 8
  • 46
  • 88
Raphael Jolivet
  • 3,940
  • 5
  • 36
  • 56

2 Answers2

8

Use the cache timeout parameter and set it to a big value (several hours) :

sshfs -C -o cache_timeout=80000 myself@work:~/files_at_work ~/my_home

Then, use this script to fetch all the files and put them into the cache :

#!/bin/bash
for file in `find .`  
do
    echo "$file"
    cat $file > /dev/null
done
Raphael Jolivet
  • 3,940
  • 5
  • 36
  • 56
  • 1
    Could you add some details, of what actually happens when trying to access the cached data? I assume that it checks (at least) file modification timestamps on the source system to determine if a cached file is still valid, so data will not be available, when the connection is unavailable, and while read throughput of cached data is increased, access latency remains roughly similar, and listing directories will be just as slow as before. Is that about correct? – Rick Moritz Jan 25 '18 at 09:50
5

I am working on a generic fuse caching filesystem called catfs which can be used to cache sshfs data. Happy to hear more feedback!

khc
  • 344
  • 2
  • 8