Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Restore Multiple Partitions Through Disk Utility With AppleScript?

Hi!


I need an AppleScript to restore a bunch of partitions from a master drive to a stack of external target drives. I don't mind partitioning them 1st, if necessary.

The master drive has 16 partitions, all equally sized, and I'd like a script to run that will have Disk Utility to just go down the list restoring each partition to the matching 16 partitions on one of the target drives.

Anyone know of or have anything l could use for this? Any advice on making this script? I'm not an advanced AppleScripter. And finally, would there be any way to have the script partition the target drives as well?


Thanks in advance!

Mac OS X (10.7.3)

Posted on Apr 13, 2012 10:39 AM

Reply
20 replies

Apr 19, 2012 3:39 PM in response to twtwtw

twtwtw wrote:


according to man asr, asr can take volume mountpoints and /dev entries. it doesn't say anything about disk identifiers. You might want to try:


do shell script "/usr/sbin/asr restore --source /dev/disk1s2 --target /dev/disk2s2 --erase" with administrator privileges


However, I'm not sure if /dev entries understand the s* notation.


I tried this. AppleScript Editor reported "Running...", but never completed anything. The 1st source partition unmounted, but that was it.

Ideas?

Apr 19, 2012 4:37 PM in response to aaanorton

interesting. was anything happening in activity monitor?


I suspect it's having trouble with the s* notation. however, since your goal is to copy the entire disk anyway, what happens if you use the following?


do shell script "/usr/sbin/asr restore --source /dev/disk1 --target /dev/disk2 --erase" with administrator privileges

Theoretically, that should copy disk1 straight onto disk2, including all the partitions. Though keep in mind the old joke: the difference between theory and practice is that 'in theory' there is no difference. You might need to check to see if it works as plain unix - sudo /usr/sbin/asr restore --source /dev/disk1 --target /dev/disk2 --erase in terminal - to make sure there's no applescript authentification bug happening (side note: only use sudo in terminal, never use sudo in a do shell script command. but you probably knew that).

Apr 19, 2012 9:37 PM in response to twtwtw

Hmmm...


do shell script "/usr/sbin/asr restore --source /dev/disk1 --target /dev/disk2 --erase" with administrator privileges

returns...


error " Validating target...done

Validating source...

Could not detect format of volume on device \"/dev/disk1\"

Could not validate source - error 254" number 1


And thank you for any cautionary tips!

Restore Multiple Partitions Through Disk Utility With AppleScript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.