Reconnect network shares on resume
From EasyPeasy Wiki
How to: Reconnect your network shares when you resume your Eee from suspend mode
This is a general tip for any Ubuntu installation, but since getting my Eee, and therefore my first ever laptop (at least with Ubuntu on it), I've found it incredibly frustrating that every time I suspend my Eee, it (naturally enough) drops my network shares to my little server upstairs.
In addition to remapping your shares on resume, this small tip will also ensure that your network shares map automatically when you first start your Eee.
NOTE : You must also follow the fix at the end of this article for shutdown/restart, otherwise your Eee will take VERY long to shutdown/restart (3 minutes plus). The fix is very straightforward however.
[edit] Specify your Shares via /etc/fstab
From a terminal, type
sudo gedit /etc/fstab
Add a line at the bottom appropriate to the mount command you use to map your network share. For example, my mount command looked like :
mount.cifs //192.168.1.100/Data /home/scaine/Network/Server/ -o guest,rw,uid=scaine,gid=scaine
And so the entry I put at the bottom of my /etc/fstab is :
//192.168.1.100/Data /home/scaine/Network/Server cifs users,rw,guest,iocharset=utf8,uid=scaine,gid=scaine,_netdev 0 0
Ensure that the fstab line is copied as a single line (there is a space between cifs and users, but not a new line).
- //192.168.1.100/Data is the share we'd like to connect to. You can also test these work from Nautilus by opening a Nautilus window, then typing 'CTRL-L' to bring up the location bar and typing (using the example here) :
smb://192.168.1.100/Data
- /home/scaine/Network/Server is a pre-created folder where you'd like to access the share from. Make sure you have full rights to where you specify here.
- "cifs" is the type of filesystem - in this case, cifs specifies a samba share.
- "guest" simply connects as the guest user. Usually, you'll set up your smb.conf to map the guest user to an actual user on your server with appropriate rights. If you don't want guest access, you can specify user= and password= here instead. Obviously though, /etc/fstab where these changes are saved is world-readable, so you probably don't want to be putting passwords in here! Check man mount.cifs for more details on how to specify a file for password details instead.
- "users" means that anyone can unmount this share, "rw" is read-write, "iocharset" specifies how filenames are managed,
- The "uid" and "gid" specify what username and group you'd like attached to new/edited files on the share. Depending on your smb.conf on the host server, this can be very important for read/write compatibility! Feel free to experiment with changing/removing the uid/gid entries, but I find they are essential, otherwise I can create new files on the share, but they're created as root, which means that I then can't write to them!
- I can't remember what the last two zeros are for. From a terminal, type 'man fstab' for more details. Something about how often the filesystem will be checked on startup, I think, so not relevant to samba shares.
- The option "_netdev" ensures the share is mounted/unmounted at the correct times during booting and shutdown. See the mount(8) man page for more information on this option.
This guide mentions samba/windows/cifs shares, but it should work just as well for NFS shares, if you have any.
[edit] Why do this?
If, like me, you've set up your Thunderbird folders to be on your central network server, you can now point Thunderbird on your Eee to use those locations and be able to check your e-mail from two separate locations with real-time updates between them.
This method also seems to ensure that when you sleep/resume, you're share are still connected once the WIFI connection is restored.

