I've been working on a fork that allows for formatting a volume or partitioning a disk as part of a deployment process.
There are two new types: "eraseVolume" and "partition".
<dict>
<key>name</key>
<string>Attempted Formatting</string>
<key>description</key>
<string>This will break everything you've ever loved</string>
<key>restart_action</key>
<string>none</string>
<key>bless_target</key>
<false/>
<key>components</key>
<array>
<dict>
<key>type</key>
<string>eraseVolume</string>
</dict>
</array>
</dict>
Erasing a volume with a new name:
<dict>
<key>name</key>
<string>Attempted Formatting</string>
<key>description</key>
<string>Erase & rename</string>
<key>restart_action</key>
<string>none</string>
<key>bless_target</key>
<false/>
<key>components</key>
<array>
<dict>
<key>type</key>
<string>eraseVolume</string>
<key>name</key>
<string>My Partition</string>
</dict>
</array>
</dict>
Erasing with a new name and format type:
<dict>
<key>name</key>
<string>Attempted Formatting</string>
<key>description</key>
<string>Erase, rename, new format</string>
<key>restart_action</key>
<string>none</string>
<key>bless_target</key>
<false/>
<key>components</key>
<array>
<dict>
<key>type</key>
<string>eraseVolume</string>
<key>name</key>
<string>My Partition</string>
<key>format</key>
<string>Journaled HFS+</string>
</dict>
</array>
</dict>
Partitioning a disk:
<dict>
<key>name</key>
<string>Attempted Formatting</string>
<key>description</key>
<string>Repartition</string>
<key>restart_action</key>
<string>none</string>
<key>bless_target</key>
<false/>
<key>components</key>
<array>
<dict>
<key>type</key>
<string>partition</string>
<key>map</key>
<string>GPTFormat</string>
<key>partitions</key>
<array>
<dict>
<key>format_type</key>
<string>Journaled HFS+</string>
<key>name</key>
<string>Macintosh HD</string>
<key>size</key>
<string>50%</string>
</dict>
<dict>
<key>format_type</key>
<string>Journaled HFS+</string>
<key>name</key>
<string>Data</string>
<key>size</key>
<string>50%</string>
</dict>
</array>
</dict>
</array>
</dict>
With partitioning, the defaults are "GPTFormat", one partition using 100% of the disk space, "Macintosh HD" using Journaled HFS+. Any options not specified are defaulted. No sanity checks are done if the admin does something like a 75% and 50% partition scheme, it'll just let diskutil try it and complain.
Good news is that it works, and resets the target volume list accordingly.
But now I have some decisions to make, and I wanted to ask the group for opinions.
How should this behave for automation? If a user selects a workflow with a target volume of "/Volumes/Macintosh HD", and that workflow has a task that repartitions the disk so that there is no longer a "Macintosh HD" volume, what should the target be for all future tasks?
Right now, I've avoided that problem by immediately breaking a workflow after a partition task is done (although I don't communicate that to the user at all - something to be fixed), so that an admin can't try to do something that might not work.
What should the automatic behavior be? Should we continue to not allow partitioning to take place with other workflow tasks? Should we add a new key like "target" to the partition task that sets the target for all future tasks to the specified volume? Should we automatically choose the first partition specified in the "partition" array?
I'd love to hear some opinions / feedback on this.
--
--
Nick McSpadden
Client Systems Manager
Schools of the Sacred Heart, San Francisco