View Full Version : A "public beta" mount/unmount surprise for you.

05-04-2006, 11:21 AM
Attached is a small preview from the next version of SuperDuper: a public beta of the new "schedule driver" that will automatically mount and unmount backup volumes without any manual intervention.

Note: the script will only automatically mount when you've got a backup directly targeted at a local volume. It does not handle the case where you have a sparse image stored on an unmounted local volume: at script time, I just don't have enough information to be able to handle that situation reliably. (Of course, SuperDuper! will continue to mount the intermediate volume automatically when you store the imag eon a network drive.)

Note that there may be some cases where identically named volumes don't work as expected: there's little I can do about that at present -- but this should improve most normal cases, while not degrading existing cases any further. (As you might expect, we never want to have regressions with a change like this.)

A small ZIP of the script is attached to this message. Unzip it, and then place the file inside SuperDuper!'s Resources folder, in the application bundle, replacing the one that's already there.

To get there, control-click on SuperDuper!, and choose "Show Package Contents". Then, navigate to Contents, then Resources, and there you'll find the existing "Copy Job Script.template".

Replace that with this one, and then (this is important) re-create your scheduled copies.

You can then unmount your backup drive, and it should automatically mount/copy/unmount if it's unmounted -- if mounted, it won't unmount at the end.

Enjoy, and let me know how it works for you.

05-05-2006, 09:22 AM
Works as advertised on a DP 800/1.25 GB RAM, 10.4.6. Thanks Dave!

05-05-2006, 09:31 AM
OK, one success. That's good, at least!

05-07-2006, 12:31 AM
This worked OK on my Quicksilver 733 Mhz PowerMac with 1 Gb RAM, OS 10.4.6, a Seritek/1S2 controller card and two 250 GB Hitachi SATA drives. A Smart Backup from the first partition on one drive to the matching partition on the other (originally unmounted) disk took 14 minutes to transfer only 300 MB of changed files out of 74 GB. After the backup the second drive got unmounted and the computer put itself to sleep. Just what I want! Thank you.

Q1: Is there an Applescript or something I can load as a startup item to automatically unmount the second drive for every day use unless SuperDuper calls for it?

Q2: I also want to automatically backup my laptop drive to a sparse disk image on the third partition of the desktop's startup drive. Is this the thing you are warning won't work? This partition is normally mounted anyway because it is on the startup disc. Following the instructions in the manual, I can have both computers scheduled to wake up at the same time, then SuperDuper will automatically connect to the desktop, mount the disk image and run a Smart Backup. SuperDuper on the laptop then unmounts the sparse image and sleeps the laptop, but it doesn't 'release' the file sharing connection to the desktop, and the desktop therefore will not sleep. As a result I find the desktop awake with all fans running the following morning and the laptop sleeping. My question is: how can I force the laptop to disconnect from file sharing to the desktop when the scheduled Smart Backup has finished? I suppose I could tell SuperDuper to completely shut down the laptop after the backup, but is there another way that would leave the laptop just sleeping?

05-07-2006, 08:14 AM
Hi, Michael.

If you want to create a little program that will unmount a drive, you'd use Script Editor to create an Applescript application with the following content:

tell application "Finder" to eject disk "the-disk-name"

Save that as an application, and then set it as a startup item.

For your 2nd issue, you can save a disk image to a local drive that's mounted, no problem. The case I'm warning about is that we won't mount/unmount the volume an image is stored on.

Finally, what you could do for your last issue is schedule the copy, then uncheck the checkbox. Locate the scheduled copy in the Library/Application Support/SuperDuper!/Scheduled Copies folder. Control-click the settings package there, and show package contents. Edit the "Copy Job.applescript" with script editor, and add an eject statement for the network job in the "after copy" area at the top. It'd look just like the above, but with the network drive name.

Save the script, then go back to SuperDuper! and double-click the entry in the Scheduled Copies window. Check the box, and we'll compile the script for you. That should do it.

05-07-2006, 11:03 AM
Thanks, Dave. My applescript, saved as an application, ran without any visible result. But the Finder menu command "Eject volume-name" is anyway greyed out.

tell application "Finder"
eject "volume-name"
end tell

I can eject/unmount the volume by dragging its disk icon to the trash, however.

05-07-2006, 11:51 AM
For "volume-name", you want to actually substitute the name of the volume you're trying to eject...

05-07-2006, 12:16 PM
I think I have done that in my actual script (where OSX_silver_B is one of the partitions I want to unmount):

tell application "Finder"
eject "OSX_silver_B"
end tell

05-07-2006, 12:48 PM
If you just "run" that in Script Editor, does it eject the volume?

05-07-2006, 01:23 PM
Nope. It remains mounted. Disk Utility and drag-to-trash are the only things that successfully unmount it.

I am curious why 'Eject OSX_silver_B", for example, is greyed out in the Finder's menu command. It is the same story for all my SATA partitions and two ATA drives working as a single RAID volume.

And, by the way, System Profiler 4.1.1 seems to know nothing of my two SATA drives. This is even though I am booted off one of them, and they get the full information breakdown in Disk Utility, where I partitioned them. In System Profiler, however, the two ATA drives running together as a RAID do appear under Hardware-->ATA; the SATA Seritek PCI card has a basic listing under Hardware-->PCI Cards; but under Hardware-->Serial-ATA I just see the phrase "No information found."

05-07-2006, 06:09 PM
OK. Internal partitions must not allow for simple ejection like this. What you'll have to do instead is crib from my script, and do something like:

tell application "Finder"
set diskID to my getDiskIDByName("the-volume-name")

if diskID is not equal to "" then
do shell script "diskutil unmount " & diskID as string
end if
end try
end tell

In your own script, copy my definition of "getDiskIDByName" and paste it in.

I don't know why it doesn't know about your SATA drive -- that's just weird...

05-07-2006, 11:20 PM
I think I will need to learn more about AppleScript to understand and implement your suggestion -- my attempts so far failed.

05-07-2006, 11:21 PM
What did you try, Michael?

05-07-2006, 11:40 PM
Er, I tried replacing "the-volume-name" with "OSX_silver_B", and I tried using 'eject' instead of 'diskutil unmount' -- I think they both gave compiling errors before I even got them into a script.

I noticed that the 'diskutil unmount' command does unmount my partitions when used in Terminal, so I played around with the following shell script, and sort of have it working as an executable Login item:


diskutil unmount /Volumes/OSX_silver_B
diskutil unmount /Volumes/OS9_silver_B
diskutil unmount /Volumes/Backups_silverB
diskutil unmount /Volumes/OSX_silver_RAID


Its a bit inelegant (leaves the Terminal window open). I sort of feel there must be a reason why people try to do this as an AppleScript.

Also I am wondering now if I really should explicitly define which partitions I want unmounting. Because, if I ever have to start up from a clone, I would rather mount the partitions on its disk and not mount those on the 'original' disk.

05-08-2006, 08:13 AM
That seems fine, Michael. My AppleScript uses diskutil/disktool to accomplish its task: AppleScript it used for ease of parsing, etc... but "do shell script" does what you'd think...

05-08-2006, 08:59 AM
As far as making the script work regardless of which disk I start up from, I am considering naming the backup disk's OSX partition with the same name as the normal startup partition. Then my login script could simply tell diskutil to unmount the OSX startup partition by name (in my case, OSX_silver). I think this should succeed in unmounting the backup partition but fail for the startup partition, shouldn't it? I already tried unmounting the startup partition, in Terminal, and it did indeed fail to unmount and seems unaffected, but I am wondering if there is any harm in doing that? I am also wondering how diskutil will react to the potentially ambiguous request: will it stop and wait for the disk choice to be be resolved?

I would try this out, but I am a bit confused about the ramifications of mounting simultaneous same-name partitions. I notice that you do sometimes recommend naming backup partitions the same as primary ones -- for example, to preserve paths and aliases. Have you written a summary note about the pros and cons -- or precautions -- of doing this anywhere?

05-08-2006, 09:04 AM
There's really no huge downside, since the system takes care of mounting them uniquely. The problem is it's going to be difficult to tell the two drives apart at script time.

The thing about naming the drives the same is that it's not important until you try to boot from the drive. So, you don't have to name it the same until you try to boot from it...

Jonathan Strait
05-08-2006, 01:12 PM
Terrific! Worked great! :D Now I don't have to concern myself with whether or not I remembered to remount volumes...

When checking SD! schedule and logs after doing test backup I did get an error on SD start up:
"SuperDuper! cannot find target volume "(null)". Please attach or mount the volume named "(null)". If you can't find this volume, or it was erased outside SuperDuper!, click Cancel."

Clicking "cancel" brings you to the SD panel with everything greyed out.

Don't remember having this problem before. Could view the schedule even with volumes unmounted (I think?) Anyway, not a problem since mounting the volumes again brings everything back to normal.

Thanks for this, J

05-08-2006, 01:14 PM
That error is pretty much expected -- you can prevent it using SuperDuper!'s preferences.

Thanks for the feedback!

05-15-2006, 01:25 PM
Excellent. Works well on my Intel iMac with LaCie USB drive. It had been bothering me that the "Open With..." context menu had always fired up my sleeping drive and shown two of everything since I switched to a direct external backup, but now it doesn't with the backup drive unmounted.

Thanks Dave!

05-15-2006, 02:07 PM
Glad it worked well for you, benbean.

05-20-2006, 09:11 AM
Attached is a small preview from the next version of SuperDuper: a public beta of the new "schedule driver" that will automatically mount and unmount backup volumes without any manual intervention.
Enjoy, and let me know how it works for you.

Perfect! Exactly what I requested!


05-20-2006, 09:29 AM
Great, Gil. It's in 2.1.1, so enjoy.