/build/static/layout/Breadcrumb_cap_w.png

KACE Product Support Question


Error creating osx sierra recovery partition

04/07/2017 1559 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;

imagename="RecoveryHD10112"
partloc="/opt/kace/petemp/ImageStore/$imagename"
 
if [[ ! -a $partloc ]]
    then
      echo "could not find recovery partition image "
      echo "should be $partloc"
      exit 1
fi
 
dcheck=`diskutil list | grep disk0s | wc -l | awk '{print $1}'`
if [[ $dcheck != "2" ]]
   then
     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
fi
 
 
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))
   then
     echo "remaining partition space is too low ($partsize)"
     echo "no room for OS"
     exit 1
fi
res="$partsize""B"
 
/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

Comments


Answer Chosen by the Author

1

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!
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ