Casper Imaging Variables

dascione
New Contributor II

I'm doing some scripting with the imaging process to help our techs get Macs in and out faster. A major factor in this is manipulation of the partition being imaged during this process. Does Casper set any environment variables during the imaging process that I can call from a subsequent script? The disk and the disk partition being imaged are the most important ones. Currently, if netbooted, the disk being imaged is almost always /dev/disk20, but this is not 100% reliable, also the partition that's being imaged is sometimes disk20s1 and other times disk20s2.

I wouldn't think it would be difficult to implement if environment variables aren't being set. From my research I can't find any articles pertaining to this.

3 REPLIES 3

loceee
Contributor

I don't believe there is, but you could use an approach similar to this.

zzz_partionhd.sh

Query all devices, find which are internal, but NOT ejectable. This script needs to be updated for fusion drives and corestorage, but it would be pretty trivial to sort it out. diskutil will query whether a disk is an SSD.

diskutil info /dev/disk0 | grep "Solid State:" | grep Yes

I hadn't built that functionality because I didn't need it myself. Find SSD & spinner, create corestorage LVG, catch the UUID, then create volume.

You'd also need to be wary of old MacPros with multiple internal disks.

bentoms
Release Candidate Programs Tester

@dascione $1 should be the target volume.

As I noted here, pre 9.65 Casper Imaging would only set the variables at launch.

But not that behaviour has changed I'm guessing that Casper Imaging will reset the value of $1 variable.

As an aside, we patition via Casper Imaging. So wondering what it is your doing that differs.

dascione
New Contributor II

Both interesting approaches, I'm hoping that the $1 variable is the way to go, I'm putting some test cases together to see if it works. If not, I can definitely work with scripting it, I think I can get it narrowed down by checking read/write status.

A little background on our issue is we have some split-brain type issues currently. I'm trying to standardize the imaging process right now, but dealing with a lot of differences in the way machines were imaged before. Mainly involving the recovery partition being included or not. Right now, there are no plans to put back the recovery partition if missing, but if it is there, we want to preserve it and wipe/image the proper partition. The wipe process includes a DOE 3-pass secure wipe, which is why I need the specific partition. Without this, most of the time it will wipe the entire drive and then Casper will error out because the partition it was going to write to is now gone.

If $1 is the way to go, I'm actually hoping I can set that variable during the process (before it clones the image). In this respect, I can actually secure wipe the whole disk, restore the recovery partition and set Casper to clone our image onto the second partition. This would hopefully standardize our systems and alleviate a lot of issues.