How to set the startup disk during Target Disk Imaging?

steventhemacman
New Contributor III

Hi Everyone,

We do target disk imaging for our Macbook Air and a few Macbook Pros. For some reason when we do this the startup disk does not seem to be "set". The computers will boot fine, however I can tell they are searching at startup for 10-15 seconds then will show the apple symbol, whereas if we login, set the startup disk and reboot, the apple logo shows up almost instantly. I am not good at scripts, I was just looking for something (a script maybe, or a setting in JSS) to set the startup disk so we dont' have to a thousand times....: ). Thanks.

7 REPLIES 7

stevewood
Honored Contributor II

I can think of two ways to do this during imaging using a script. Using either the bless command from the OS, or the bless verb from the jamf binary:

Usage:  jamf bless -target <path to target> [-setOF]
jamf bless -bootargs <boot-args> -bootfile <boot-file> -bootdevice <bootdevice>

You would of course need to know the disk that you want to boot to. I just cobbled this together quickly, so you'll want to test this, and I'm sure someone else on list will let you know if there is an easier way:

#!/bin/sh

# get the volume path
bootVolume=`diskutil list | grep -i "macintosh hd" | awk '{ print $7 }'`

# bless the boot volume
jamf bless -target /dev/$bootVolume

Of course, if your internal drive is not named Macintosh HD, you'll want to change the grep in that script. Also, you'll want to make sure there are no other drives named "Macintosh HD", so re-naming the drive you are booting from to do the imaging is important.

Like I said, I'm sure there's another way I'm not thinking of, and I'm sure someone on list will respond with it. Right @mm2270? πŸ™‚

steventhemacman
New Contributor III

I will give it a test run and let you know. Looks pretty straight forward. Thanks!

mm2270
Legendary Contributor II

Heh πŸ™‚ Sorry, but I've got bupkis more or less here. Since the drive you're booting TO won't actually be the drive you're booted FROM during imaging, the way @stevewood][/url wrote it would be the best way I can think of. Getting the boot volumes disk identifier is easy even if you don't know the name of the drive, but that's not what we're actually talking about. While its being imaged or after its imaged, it looks more or less like any other internal HD would, so no tricks up my sleeve for this.
If your drives are not named "Macintosh HD" as Steve mentioned, then you;d have to adjust your script accordingly.

Edit: Also, meant to say this, but Casper Imaging should be setting the drive as the boot volume I believe. So if that's not happening, you might want to look into why further, Maybe contact your Account Manager on that to see if they have any thoughts.

bentoms
Honored Contributor III
Honored Contributor III

If you add a script to your imaging workflow that looks for the .jamfTarget file created by Casper Imaging (https://jamfnation.jamfsoftware.com/discussion.html?id=10545), you could then adapt the script that @stevewood posted to get that volumes name.

Although, I though Casper Imaging did the bless anyways.

steventhemacman
New Contributor III

I see that it blesses it during the image process. But it does not seem to work. I am about to try his scripto here is a sec...

steventhemacman
New Contributor III

This is the error I am getting.

There is a problem with your syntax.
Error: A valid system was not found on the specified drive. (/Volumes/dev/disk0s2/System/Library/CoreServices/ does not exist)

I pretty much copy and pasted @stevewood script. Not sure what I am missing.

sean
Valued Contributor

Is jamf bless adding /Volumes?

You either need to refer to /Volumes/[name of volume]
or
/dev/disk[identifier]

/Volumes/dev/...... wont exist