Posted on 10-24-2017 04:17 PM
Hi all, we're looking at the possibility of having a script to convert an APFS drive to HFS+ before the block copy begins
We're having no luck with DEP, and the issues around account creation/authenticating, so I'm trying to figure this out.
I've got the following
#!/bin/sh
diskutil apfs deleteContainer /dev/disk0s2
diskutil eraseDisk JHFS+ "Nuked" /dev/disk0
echo | diskutil info disk0s2
When we type it by hand (in the 10.13 netboot environment) it works, but having it run as the first step in the configuration doesn't reformat it
Any ideas?
Running JSS 9.101
Target machine on 10.13, APFS
Posted on 10-25-2017 12:54 AM
I guess my first question is 'why?' Is there a specific issue you're running in to with APFS? I'd be hard pressed to spend time going backwards at this point without a big win.
Posted on 10-25-2017 07:20 AM
instead of eraseDisk how about using partitionDisk? e.g.
diskutil partitiondisk disk0 1 GPTFormat JHFS+ "Macintosh HD" 100%
Posted on 10-25-2017 08:53 AM
Hello @wallis.isaac have you considered installing high Sierra using where there is no APFS conversion? We use a command that essentially removes the APFS conversion.
/Applications/Install macOS High Sierra.app/Contents/Resources/startosinstall --applicationpath /Applications/Install macOS High Sierra.app --agreetolicense --converttoapfs NO --nointeraction
This will install High Sierra using a command where there is no interaction for the user, no APFS conversion and the license agreement is agreed to. As long as the path to the installer is the correct path, this should work well and of course, the installer is copied to the Mac in the first place.. In our limited testing, we have found this to work well.
Like many things with JAMF and Apple, there are a gazillion ways to do different things. Maybe this command will assist. I learned this from https://derflounder.wordpress.com/2017/09/26/using-the-macos-high-sierra-os-installers-startosinstall-tool-to-avoid-apfs-conversion/
Best of luck...
Posted on 10-26-2017 07:20 AM
I would assume that this is in effort to image a Mac with a version of macOS prior to 10.13, but your NetBoot set is made with 10.13?
You mentioned typing the command by hand works; if you convert a partition to JHFS+ and then let Imaging do the block copy, does that result in an imaged disk which is formatted the way you want?
Posted on 05-03-2018 12:37 PM
Hello all,
I was wondering a question on this same line of thinking... I think.
We need to reimage all of our 1300+ devices this summer, installing the new 13.4 OS and wipe the drive with APFS.
We have a script that will install the "Install macOS High Sierra" app in the Applications folder, so that is no biggie. Just a Push out the install app and then a script to run the install script... but to wipe the drive then install the new OS has proven a hurdle I cannot seem to rectify.
Any help with it would be greatly appreciated. We are using the script made by someone @ Jamf, but doctored a little to meet our needs, See below for the script.
Thanks All,
~Hoop
userDialog=1
OSInstaller="$4"
version="$5"
download_trigger="$6"
macOSname=echo "$OSInstaller" |sed 's/^/Applications/Install (.*).app$/1/'
title="$macOSname Upgrade"
heading="Please wait as we prepare your computer for $macOSname..."
description="
This process will take approximately 40-60 minutes.
Once completed your computer will reboot and begin the upgrade."
dldescription="We need to download $macOSname to your computer, this will
take several minutes."
icon="$OSInstaller/Contents/Resources/InstallAssistant.icns"
pwrAdapter=$( /usr/bin/pmset -g ps )
if [[ ${pwrAdapter} == "AC Power" ]]; then
pwrStatus="OK"
/bin/echo "Power Check: OK - AC Power Detected"
else
pwrStatus="ERROR"
/bin/echo "Power Check: ERROR - No AC Power Detected"
fi
osMinor=$( /usr/bin/sw_vers -productVersion | awk -F. {'print $2'} )
if [[ $osMinor -ge 12 ]]; then
freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $6}' | cut -c 2- )
else
freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $6}' | cut -c 2- )
fi
if [[ ${freeSpace%.} -ge 15000000000 ]]; then
spaceStatus="OK"
/bin/echo "Disk Check: OK - ${freeSpace%.} Bytes Free Space Detected"
else
spaceStatus="ERROR"
/bin/echo "Disk Check: ERROR - ${freeSpace%.*} Bytes Free Space Detected"
fi
if [ -e "$OSInstaller" ]; then
/bin/echo "$OSInstaller found, checking version."
OSVersion=/usr/libexec/PlistBuddy -c 'Print :"System Image Info":version' "$OSInstaller/Contents/SharedSupport/InstallInfo.plist"
/bin/echo "OSVersion is $OSVersion"
if [ $OSVersion = $version ]; then
downloadOS="No"
else
downloadOS="Yes"
##Delete old version.
/bin/echo "Installer found, but old. Deleting..."
/bin/rm -rf "$OSInstaller"
fi
else
downloadOS="Yes"
fi
if [ $downloadOS = "Yes" ]; then
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper
-windowType utility -title "$title" -alignHeading center -alignDescription left -description "$dldescription"
-button1 Ok -defaultButton 1 -icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/SidebarDownloadsFolder.icns" -iconSize 100
##Run policy to cache installer
/usr/local/jamf/bin/jamf policy -event $download_trigger
else
/bin/echo "$macOSname installer with $version was already present, continuing..."
fi
/bin/mkdir /usr/local/jamfps
/bin/echo "#!/bin/bash
/bin/rm -fdr "$OSInstaller"
/bin/sleep 2
/usr/local/jamf/bin/jamf recon
/bin/rm -f /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist
/bin/rm -fdr /usr/local/jamfps
exit 0" > /usr/local/jamfps/finishOSInstall.sh
/usr/sbin/chown root:admin /usr/local/jamfps/finishOSInstall.sh
/bin/chmod 755 /usr/local/jamfps/finishOSInstall.sh
cat << EOF > /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.jamfps.cleanupOSInstall</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>/usr/local/jamfps/finishOSInstall.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
/usr/sbin/chown root:wheel /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist
/bin/chmod 644 /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist
/usr/bin/caffeinate -dis &
caffeinatePID=$(echo $!)
if [[ ${pwrStatus} == "OK" ]] && [[ ${spaceStatus} == "OK" ]]; then ##Launch jamfHelper if [[ ${userDialog} == 0 ]]; then /bin/echo "Launching jamfHelper as FullScreen..." /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -title "" -icon "$icon" -heading "$heading" -description "$description" & jamfHelperPID=$(echo $!) fi if [[ ${userDialog} == 1 ]]; then /bin/echo "Launching jamfHelper as Utility Window..." /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "$heading" -description "$description" -iconSize 100 & jamfHelperPID=$(echo $!) fi
##Begin Upgrade
/bin/echo "Launching startosinstall..."
"$OSInstaller/Contents/Resources/startosinstall" --applicationpath "$OSInstaller" --nointeraction --pidtosignal $jamfHelperPID &
/bin/sleep 3
else
## Remove Script
/bin/rm -f /usr/local/jamfps/finishOSInstall.sh
/bin/rm -f /Library/LaunchDaemons/com.jamfps.cleanupOSInstall.plist
/bin/echo "Launching jamfHelper Dialog (Requirements Not Met)..." /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "Requirements Not Met" -description "We were unable to prepare your computer for $macOSname. Please ensure you are connected to power and that you have at least 15GB of Free Space.
If you continue to experience this issue, please contact the IT Support Center." -iconSize 100 -button1 "OK" -defaultButton 1
fi
kill ${caffeinatePID}
exit 0
Posted on 10-09-2018 07:21 AM
Hi All
I am trying to run below command to skip APFS in terminal during High Sierra installation but get error "No such file or directory". Could anyone advise what needs to be done ?
/Applications/Install macOS High Sierra.app/Contents/Resources/startosinstall --converttoapfs NO
Posted on 10-09-2018 02:05 PM
@Yogini90 , try the below...I'm thinking you may need to set the path to the installer via the --applicationpath flag:
/Applications/Install macOS High Sierra.app/Contents/Resources/startosinstall --applicationpath /Applications/Install macOS High Sierra.app --converttoapfs NO