I'm using afuse to mount some remote directories via sshfs. This works well, but I'm interested in exploring some options like -o kernel_cache and -o large_read.

Afuse works by specifying a mount_template, in this case a string which contains an sshfs invocation. Now, obviously, sshfs options like -o reconnect or -o transform_symlinks go in that template, and afuse options like -o timeout=300 go on the afuse command line.

But what about fuse options which can apply to both? Should these go:

  • in the sshfs invocation template?
  • directly to the afuse command?
  • or, both?

Will using the options twice result in (for example) unnecessary double-buffering, or is it necessary for it to be in both places to be meaningful? (For example, large reads might need to be enabled in both places or else they're broken up.)


If this is still useful to someone, here is the basic idea:

Create an executable script called mount.afuse and put it in /usr/bin/mount.afuse

su -l $( ls -dl "$2" | cut -d' ' -f3) -c "afuse -o mount_template='sshfs -o reconnect -o auto_cache -o kernel_cache %r:/ %m' -o unmount_template='fusermount -u -z %m' -o auto_unmount '$2'"

Include a line in your /etc/fstab

afuse# /mnt/afuse afuse auto 0 0

To test that everything works, you should be able to execute the mount.afuse script first.

Source: https://gist.github.com/Hubbitus/c40d986921cbed6a8ad585eee00a7d77

| improve this answer | |

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.