Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'know how to unmount network drives on sleep?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
know how to unmount network drives on sleep?
Authored by: jonny5 on Jul 17, '03 11:54:20AM
Great hint - does anyone know of an easy script to unmount network drives that can be executed on sleep by this? I have been looking for something like this to avoid the unpleasant effects of changing networks w/ old drives still mounted....

This hint mentions disktool and diskutil. I suppose you could do something like this in the .sleep script:

for VOL in $(ls /Volumes); do
diskutil eject /Volumes/"$VOL"
done


but, are there any potential issues? what if a finder window was open for one of those volumes? or an app had a file open?

unfortunately I can't test this now... I'm away from my network. thanks, Jon

[ Reply to This | # ]
know how to unmount network drives on sleep?
Authored by: triplef on Jul 18, '03 08:40:49AM

Nice idea! I tried using

for VOL in /Volumes/*; do
        diskutil eject "$VOL"
done

in my .sleep file, which works nice with mounted disk images. However, I cannot get a disk mounted from a Linux box over Netatalk to eject. It simply doesn't work, even when I execute the command manually.

bash-2.05a$ diskutil eject "/Volumes/Space"
Disk Utility Tool       Š2002, Apple Computer, Inc.
Usage:  diskutil [mount(Disk)|unmount(Disk)|eject]
[Mount Point|Disk Identifier|Device Node]
Mount, unmount or eject disks or volumes.  Root access is not required.
Example:  diskutil unmount /Volumes/SomeDisk

Any ideas?



[ Reply to This | # ]
know how to unmount network drives on sleep?
Authored by: jonny5 on Jul 18, '03 09:42:40AM

Now that I'm at home & attempting this w/ my network, it seems that diskutil doesn't work (unmount or eject) for disks shared via SMB either. Anyone know how to unmount these via the command line???



[ Reply to This | # ]
There is way to unmount network volumes
Authored by: atverd on Jul 18, '03 01:12:51PM

umount /Volumes/name
will do, so you can put it as second similar loop in your script after first pass with diskutil. But after all you'll need to run
disktool -r
to refresh internal table of mounts used by Finder and Co (to remove icons from desktop).



[ Reply to This | # ]