Saturday, October 20, 2007

Easier Sharing: SSHFS

My last post was on how I used Samba to share files from my central media server to other machines on my local network. Seemed great at first, but having used it for a little while, I was rather disappointed. I had Rhythmbox looking at the mounted drive as my library. It started scanning the files once the directory was mounted. I could play them, but after a few minutes, Rhythmbox would freeze scanning the files. In addition, I could not even list the directory that contained the mounted directory. Something was getting frozen. This kept happening more and more, and was quite frustrating.

I then tried of SSHFS for the same purpose, and it has been working much better. If you can SSH to the machine with the files you want to share, then you don't have to make any changes to that computer. Just a few steps on the machine that will be accessing the remote store, and you are ready to go. From the top:
  • Create the dir which to which the remote dir will be mounted (e.g. /home/myuser/Music)
  • Make sure you have ssh access on remote machine from the local machine
  • On the local machine:
    • sudo apt-get install sshfs
    • sudo modprobe fuse
    • sudo usermod -G fuse -a youruser
    • sudo chgrp fuse /dev/fuse
    • Logout of myuser on the local machine, then back in
    • sshfs 192.168.1.6:/dir/on/remote/server LOCALDIR
sudo modprobe fuse will make sure you have that kernel module loaded. You have to be in the fuse group to perform the mount, sudo or not. I am not exactly sure why you have to change the group of the fuse device, but you definitely have to to get it to work.

At this point, you should be able to view all the files in /dir/on/remote/server from LOCALDIR. Performance wise, I had great success. Pointing Rhythmbox to the dir I mounted, it scanned all the files in a timely manner, and I was able to play them as if they were on the local machine without issue.

If you wish to unmount the share, run sudo fusermount -u LOCALDIR. One problem that has been suggested for which I do not have a fix yet is how to handle if the remote machine has a problem, reboots, or the network connection is otherwise dropped. I am not sure how this would be handled, since the mount would no longer work. fuse being a kernel module, this may cause freezing. If I find this addressed somewhere, I will post it.

Additional information and links:

1 Comments:

Blogger Carl-Erik said...

thanks. didn't get samba to play well along with media players either (winamp, rhythmbox).

March 18, 2008 at 3:42 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home