KACE Product Support Question

Error creating osx sierra recovery partition

04/07/2017 1335 views
Since the K2100 4.1 update, I get an error while creating the recovery partition when deploying a MacOs Sierra image. In previous version i have used included script without problems. Error says 'create_osx_recovery_partition.sh: line 23: let: tds=: syntax error: operand expected (error token is "=")
remaining partition space is too low (-870203392)
no room for OS'
Anyone have the same problem? Entire recovery creation script;

if [[ ! -a $partloc ]]
      echo "could not find recovery partition image "
      echo "should be $partloc"
      exit 1
dcheck=`diskutil list | grep disk0s | wc -l | awk '{print $1}'`
if [[ $dcheck != "2" ]]
     echo "can not be run on disk0 without and existing HFS partition"
     echo "or with more than one. there are $dcheck on disk0"
     exit 1
let rpartsizeb=`ls -l $partloc | awk '{print $5}'`
let rpartsizes=$rpartsizeb/512
let tds=`diskutil info disk0 | grep "Total Size" | awk '{print $5}' | sed 's/(//g'`
let efisize=220200960
let partsize=$tds-$rpartsizeb-$efisize
if (($partsize<$efisize))
     echo "remaining partition space is too low ($partsize)"
     echo "no room for OS"
     exit 1
/usr/sbin/diskutil resizeVolume "$KACE_SYSTEM_DRIVE_NAME" "$res"
slice=`df | grep disk0 | awk '{print $1}' `
sleep 5
/usr/bin/hdiutil detach $slice
let parts=`gpt show disk0 | grep 48465300 | awk '{print $1 }'`
let partl=`gpt show disk0 | grep 48465300 | awk '{print $2 }'`
let partbase=$parts+$partl
gpt add -b $partbase -s $rpartsizes -t 426F6F74-0000-11AA-AA11-00306543ECAC disk0
pname="Recovery HD"
dd if=$partloc of=/dev/disk0s3
sleep 2
/usr/bin/hdiutil detach $slice
gpt label -i 3 -l "$pname" disk0
exit 0    
Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author


I had this error and our engineer discovered the following issue:

let tds=`diskutil info disk0 | grep "Total Size" | awk '{print $5}' | sed 's/(//g'`


But there is no line “Total Size” in the output of “diskutil info disk0”. But there is a line: “Disk Size”, so I changed it to:


let tds=`diskutil info disk0 | grep "Disk Size" | awk '{print $5}' | sed 's/(//g'`


That did the trick.

Answered 05/17/2017 by: calixvic
White Belt

  • Mark, I have tested your solution and indeed it works. Thank you very much!