pre-partitioning scripts

neilashdown
New Contributor

is there anyone that could help with a preinstall script that would erase the HD and create three partitions, one Macintosh HD, one Recovery HD and a DATA, I would like the Recovery to be 1GB the DATA to be either 400GB or <75% depending on the size of Drive

5 REPLIES 5

jacob_salmela
Contributor II

You could run something like this as a before script, modifying the values as needed.

#!/bin/bash
hardDiskID=$(diskutil list | awk '/GUID_partition_scheme/ {print $5}')
diskutil partitionDisk $hardDiskID 3 GPT JHFS+ "Macintosh HD" 24% JHFS+ "Data" 75% JHFS+ "Recovery HD" R

I used a script similar to the above for partitioning the drive to put the /Users folder on a separate partition. Not perfect by any means, but it should get the job done.

bentoms
Release Candidate Programs Tester

@jacob_salmela, nice blog post. That is for linking to mine & referencing @localhorst whom I punched the idea off of. :)

@neilashdown, we partition as part of our configuration is casper admin. You should be able to set 1GB for recovery (but why? You can lay that down via an AutoDMG OS.dmg). Then set your Data drive to 75% of what's left.

neilashdown
New Contributor

thanks for that but have an issue, I am trying to use Target disk to test this script before I install as a 'Before' it seems to read it but doesn't actually create the partitions, any advice appreciated

neilashdown
New Contributor

The main issue I am having is that after updating to 10.10 and Server4 I can not longer Erase drives and partition then at NetBoot, what happens is that it attempts to unmount and erase and just skips past the partition part therefore not getting the result I would like to achieve. this all worked fine under 10.9 and Casper 9.5 :(

Any ideas?

bentoms
Release Candidate Programs Tester

@neilashdown, I guess in the above you were referring to Casper Imaging pre-9.6?

I think I just posted on this issue (seeing as we both pinched the FSTAB idea off of @localhorst): https://macmule.com/2015/01/02/casper-imaging-corestorage-volumes/