So far I've been using the following AppleScript to eject all external drives at once conveniently using a shortcut:
tell application "Finder" eject (every disk) end tell
This script is is stored in
/Library/Scripts and I have assigned a shortcut to trigger it in FastScripts.
But there's one problem. When you have Time Machine Backups enabled, OS X mounts a virtual
MobileBackups volume in
/Volumes to store local snapshots. This volume will be ejected alongside all the physical external volumes. I want to avoid this as this will stop local snapshots from being made (until it's mounted again at next login).