There are a bunch of good suggestions here:
http://ubuntuforums.org/showthread.php?p=8947629
Combining those suspend scripts with airtonix's suggestions gave me a solution that appears to work. (I have only tested it once so far.)
Code:
#!/bin/bash
#
# gnome-power-control
# Original Author: AgenT
# see http://ubuntuforums.org/showthread.php?p=8947629
#SETUP
#1) Save the above as: suspend-unmount.sh
#2) Change file permissions to execute (right click on file -> properties -> permissions)
# or sudo chmod a+x /usr/bin/suspend-unmount.sh
#3) optional: move this script into your ~/bin/ folder for easy access!
# or place it anywhere on the path. Check with $ echo $PATH
#USAGE
#To suspend: suspend-unmount.sh
SERVER_NAME=192.168
# write all unwritten data (just in case)
sync
# comment out NFS mounts (mine are all on one server, fortunately)
sed s/"$SERVER_NAME"/"#$SERVER_NAME"/g -i /etc/mtab
#need to do this for all NFS mounts! This is experimental:
umount -a -t NFS -f
sudo pm-suspend
# restore mount descriptors
sed s/"#$SERVER_NAME"/"$SERVER_NAME"/g -i /etc/mtab
# mount
sudo mount -a
When I ran it, it suspended beautifully and really quickly. Waking up was trouble-free too. But upon waking up, I saw this output:
Code:
~/bin$ sudo ./suspend-unmount.sh
mount.nfs: /volume/one is busy or already mounted
mount.nfs: /volume/two is busy or already mounted
mount.nfs: /volume/three is busy or already mounted
mount.nfs: /volume/four is busy or already mounted
mount.nfs: /volume/five is busy or already mounted
Not a big deal for me. Those are just messages, not errors. But I might experiment with variations on the mounting.
EDIT: even though everything is working, the NSF mounts on SERVER_NAME are missing from /etc/mtab after resuming. But I can access the NFS shares just fine. Not exactly sure what's going on...
Bookmarks