On my laptop, a Macbook Pro 7,1, I need to remove all the fuse mounts before I disconnect from the network. If I don't disconnect these fuse mount points before I suspend or shut down then fuse seems to lock up. I believe that is because after I put the machine to sleep it will no longer be connected to the network when I turn it back on. Here's how I do it.
Here's the line of commands I use to unmount all of the mount points currently mounted with fuse.
mount -l -t fuse.sshfs | awk -F " " '{print "fusermount -u " $3}' | bash
I'll break these commands down for you so that they are a little easier to understand.
In the first part, we list everything that is currently mounted with a type of fuse.sshfs.
mount -l -t fuse.sshfs
Next, we pipe that output into awk, splitting on spaces, and printing out the fusermount command that will unmount each of them. I have another page about Using AWK on CSV Files that explains this command in a little more detail.
awk -F " " '{print "fusermount -u " $3}'
Finally, we pipe that output back into bash so that each command is executed.
bash
On my system, Ubuntu 10.10 Maverick, I'm using pm-utils. To execute something on suspend (sleep) I create a script in the /etc/pm/sleep.d directory. Here's the whole script.
#!/bin/sh mount -l -t fuse.sshfs | awk -F " " '{print "fusermount -u " $3}' | bash
I've called the script 05_fuse and then I ran chmod to make the file executable.
sudo chmod +x 05_fuse