Gentoo MythTV

27. 08. 08

mystery with sshfs

Filed under: configuration, Main — Tags: , , , — niko86 @ 10:10

since a friend told me about sshfs i was keen to test it.

so i set up passwordless authentication for a user that has read permissions on my storage server.

in order to let mythtv frontends view videos from the storage server i had to mount.

i do not like cifs or samba, neither nfs, so i thought to myself: “well let’s go with sshfs!”

simple as that:

just enable the fuse option in the kernel (i do not remember the exact name, you can find it under filesystems, userland support or something)

emerge -av sshfs-fuse

and your ready.

mounting is easy:

sshfs -o some,mount,options user@server:/path/to/storage /your/local/mountpoint

you can also use sshfs in /etc/fstab:

just add this line:

sshfs#user@server:/path /mount/point fuse some,mount,options 0 0

now you can just type:

mount /mount/point

to mount sshfs at startup you have to setup passwordless authentication though.

i will not explain this, a quick google search should do the trick if you are not already using this.

looks fine, ain’t it?

well, there certainly is one flaw with this nice sshfs thingie.

on shutdown or reboot gentoo tries to unmount the filesysems, it also tries to unmount our sshfs mounts.

it simply fails, i don’t know why, but the systems just kinda stops to shutdown and will stay in a state where it has no network connection and no prompt at all.

i came up with a quick dirty fix for this.

just add this to your /etc/init.d/shutdown.sh and /etc/init.d/reboot.sh:

#dirty fix for sshfs problems on shutdown
sleep 1 && echo "Unmounting SSHFS"
for i in `/bin/awk '/sshfs/ {print $2}' /etc/mtab`; do /usr/bin/fusermount -u $i; done
sleep 1 && echo "Done"

that will solve the kinky problems on shutdown.

Blog at WordPress.com.