Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an SSHFS mount from a Ubuntu Server VM guest, mounting a host Mac OS X directory. Changes made directly in the Mac OS X host directory take approx 5 - 10 seconds to reflect in the Ubuntu Server VM guest mount.

I am using the following command...

sshfs user@host: ~/host

What additional options (if any) will improve this latency?

share|improve this question
    
How are you determining it takes 5-10 seconds? –  Kyle Apr 30 '12 at 16:43
    
@Kyle, 5-10 seconds seems pretty close to the correct value since the default {stat,dir,link} cache is 20 seconds. –  Zoredache Apr 30 '12 at 17:28
    
@Kyle I'm simply running a watch -n 1 'ls -l ~/host' on the mount point and creating a directory or file in the host and seeing how long it takes to appear. –  m.p.c Apr 30 '12 at 19:53
add comment

1 Answer 1

up vote 2 down vote accepted

SSH is not designed to be a file transfer protocol. SSHFS works by periodically looking at the directory list and caching results.

You can control the caching behavior, but at the cost of performance as it relates to interactivity. If the SSH host you are connecting is accessed via a high latency link, or slow connection, then disabling caching is going to make things browsing the filesystem painful.

Anyway, see the man page, and experiement a bit.

man sshfs

   -o cache=YESNO
          enable caching {yes,no} (default: yes)

   -o cache_timeout=N
          sets timeout for caches in seconds (default: 20)

   -o cache_X_timeout=N
          sets timeout for {stat,dir,link} cache
share|improve this answer
    
Thanks, hadn't spent enough time reading the manual to see these options. –  m.p.c Apr 30 '12 at 19:49
    
Any commands that'd force an immediate rescan? I suppose a shell script containing R=".rescan.tmp$RANDOM" if [ ! a $R ]; then touch $R; rm $R; fi perhaps? Any cleaner way? –  Jeff Burdges Jun 17 '12 at 12:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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