SSHFS how-to set up for best performance

From Urandom
Jump to: navigation, search
* Install SSHFS ( http://fuse.sourceforge.net/sshfs.html )
* First try to simply mount something to make sure that you SSH connection works. 
sshfs USER@HOST:DIRECTORY DESTINATION -o allow_other,reconnect,transform_symlinks
Example:
sshfs mardicas@fserver:/mnt/fujitsu/MARDICAS /media/fujitsu/ -o allow_other,reconnect,transform_symlinks,
* To see what the options do then just "man sshfs".
* I would suggest to follow the ubuntu sshfs automounter guide if you use Ubuntu or similar distros. ( http://ubuntuforums.org/showthread.php?t=430312 )
* And try to add it to your FStab so you don't have to mount it manually every time. NB: use passwordless logins.
* After you get it to work and you find that the CPU load or/and speed is not fast enough then here is how-to speed things up.
* When using the default SSH2 cipher i got ~12mb/s speed and 100% CPU load on the server (Intel atom 1.6ghz)
* After researching i found out that the fastest cipher is arcfour, this gave me ~25mb/s

* This is how i implemented it: 
* CAUTION:The arcfour cipher is not very secure, use only over a trusted network.
* Create a new file for example: /usr/bin/ssh_arcfour
#!/bin/sh
/usr/bin/ssh -c arcfour -i /home/mardicas/.ssh/id_rsa $@
* Don't forget to add "chmod +x /usr/bin/ssh_arcfour"
* Make sure that the -i points yo your identification file for passwordless login.

Now edit the /etc/fstab file so that the option "ssh_command=ssh_arcfour"

sshfs#USER@HOST:/DIRECTORY    /DESTINATION  fuse    noauto,users,exec,uid=1000,gid=1000,allow_other,reconnect,transform_symlinks,ssh_command=ssh_arcfour 0 0