View Full Version : something osx that has bugged me.. (network-related)

10th January 2007, 06:47 PM
isn't a bit.. well.. weird that when you have smb mounts on your notebook, mounted via automount of course, it gets disconnected when closing the lid, or putting your computer to sleep?

10th January 2007, 06:50 PM
Of course they disconnect, what on earth did you expect. The machine is literally turning off into a form of sleep mode. So it can spring back to life without waiting for a complete boot up sequence.

Logic tells me and many others this is what you expect, why on earth do you fell this is not right.

10th January 2007, 07:06 PM
mount_smbfs does not dismount though :\

10th January 2007, 07:07 PM
Becasue normally what should happen is when you open the lid again the SMB shares get re-mounted as that is what state they were in when you closed the lid. It's not too unreasonable to ask.


p.s. I have no idea how to get around it BTW

10th January 2007, 08:11 PM
mount_smbfs does not dismount though :\

And if you had nfs shares they too would not dismount... its not upto these services to dismount, the machine should be configured to do stuff at sleep (much like it does when it does a shutdown).

11th January 2007, 09:35 AM
uhmmmmm okay.....

so Windows hibernate is like osx's sleep?

12th January 2007, 06:52 AM

12th January 2007, 07:23 AM
Is there any way of having shared drives automatically mounted again after a sleep or restart instead of having to manually do it? Thanks! :)

12th January 2007, 07:31 AM
Once you mount the drive. Go into System Preferences >> Accounts >> Login Items. Then drag and drop the mounted volume from the desktop to that list.

Provided the share is always available online, the volume will mount each time you reboot.

As for coming out of sleep, sometimes it unmounts, other times it doesn't... good ol Finder ;) OS X is good, but not perfect.


12th January 2007, 07:49 AM
Thanks! Sounds easy!

12th January 2007, 05:17 PM
Interesting. :) I did the above - doesn't seem to remount after a sleep or restart or reboot, but this is a shared drive over a wireless network, so it's possible that the remounting is being attempted before the wireless reconnects.

12th January 2007, 05:29 PM
hopefully it gets fixed in 10.5

12th January 2007, 06:26 PM
so Windows hibernate is like osx's sleep?

In a sense. This is how Windows Hibernate mode works:

1) dismounts all network connections
2) suspends every non-kernel task
3) flushes all I/O buffers and then closes them, including virtual memory
4) re-opens volume write to the system volume and does a full read of RAM and writes it out to hiberfil.sys, then modifies the ms.sys (I think) file with a microloader to 'boot' the computer by reading all of hiberfile into RAM and jumping to the un-hibernate routine.
5) calls all devices with power management APIs except the CPU and the designated I/O channels (keyboard, mouse, and/or network, whichever 'on wake' interrupts have been set in the BIOS) and forces them to shut down, if their hardware allows it -- things like drive sleep and spin-down, soundcard, or monitor stand-by.
6) suspends everything at safe spots (re-entry points into all kernel routines as the next instruction-code) then tells the CPU's PMU to switch off.

Un-hibernation works as you would expect, in reverse. The first thing the Windows core (a morass of files & data not too dissimilar from OSX's kernel) "realises" is that it's been dropped into wake-up, turns on VM, starts all routines where they left off, takes services and apps out of standby, then looks at a list of whatever it had shut down and turn them back on, and lastly, re-open the network connections.

Re-opening network connections is always left until last. It is best that all of the OS is running first, which includes any and all anti-malware/protection software, and then opening the network up. Like opening the gate in the fence to let the horse out before you've got the door to the barn all the way closed, a clever fox could zip through that closing gap and have a lambkin in its teeth before you knew it.

That's why network shares on many platforms always appear to malfunction after sleep or hibernate -- one of the apps that gets going early is Finder or Explorer, and if you left any open windows that displayed part of a network share, that program would go "Waahhh, I can't see it, it's broken!!" and close them on you. However, some internet apps like browsers, streaming radio and the like, seem quite happy because they're geared around waiting for network connections. Finder and Windows Explorer both are quite quite brain-dead in that regard.

How to stop this nagging about reconnecting after a sleep? Close windows that point to a network share before you sleep, then you won't notice it. The connections come back well after Finder or Explorer are ready, you just have to re-open the folders that lead to the network shares. The inspired could write an AppleScript to do that -- do a 'clean' sleep by noting the open Finder windows and shares, write them to a prefs, close them, and issue a sleep command. You'd have its opposite on the desktop that you could open a few seconds after everything seems to have 'settled.'