Trying to securely erase a drive before applying an image

New Contributor

I'm trying to securely erase a drive and rename it to "Macintosh HD" using "diskutil partitionDisk" in a script that Casper Imaging runs before applying an image. However I'm running into an issue in the case that the disk is not already named "Macintosh HD". Casper continues as if there is no problem, but the rest of the imaging process does not have any effect to the target drive. Is there a way to do this in a configuration for Casper Imaging?


Valued Contributor III

I would like to see this as well, I have a script on the desktop of our boot image that we run as needed before Casper Imaging (to delete any CS volumes and get the drive to a consistent partition/name state). I haven't played around with it much but I am curious.

Valued Contributor II

This is what we use..

set UUID=diskutil cs info disk0s2|grep LVG |awk '{ print $4; }'
echo "$UUID"
diskutil cs delete $UUID
diskutil partitionDisk disk0 GPT JHFS+ Macintosh HD 100%