Secure Drive Erase before Imaging

alexjdale
Valued Contributor III

Has anyone implemented this? Not a full DoD wipe, just zeroing the drive before dropping an image. I assume I can run a script before the block copy of the DMG and prompt the tech to select the drive then run a secure erase.

While on the topic, am I missing something regarding re-imaging FV2-encrypted drives? Right now we manually have to destroy the Logical Volume Group before launching Casper Imaging.

4 REPLIES 4

RobertHammen
Valued Contributor II

I would possibly create an Automator app to run the script for you (done this before to work around issues with volumes not properly partitioned).

I have the same experience with having to destroy the logical volume group via Terminal commands before imaging...

jarednichols
Honored Contributor

Man diskutil

gachowski
Valued Contributor II

I use a csh script saved as a .command for our onsite to run. I also remove the machine from the JSS at the same time..

This works for me, but I am sure I am not doing 100% "right"

#!/bin/csh

# getting core storage family name
set LVG=`diskutil cs info disk0s2|grep LVG |awk '{ print $4; }'`

#echo "$LVG"

# deleting core storage volume 
diskutil cs delete $LVG

# partitioning drive
diskutil partitionDisk disk0 GPT JHFS+ Macintosh HD 100%

# getting UUID
set UUID=`ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, """); printf("%s
", line[4]); }'`

# deleting computer from casper with UUID
curl -k -v -u username:password https://myjssV9:8443/JSSResource/computers/udid/$UUID -X DELETE

mm2270
Legendary Contributor III

In my experience at least, there's no need to remove the CoreStorage Logical Volume before reformatting the volume.

We run a script very similar to your partition drive line. It looks like this-

diskutil partitionDisk disk0 GPT JHFS+ "Macintosh HD" R

And we've never had an issue. Once its flattened that way, we can let the imaging process partition the drive again and lay down the Recovery HD and base OS.
I should note however that we use DeployStudio, not Casper Imaging, so I don't know if that makes a difference. I can't see why though.