Need Help Resizing Restore Partition

aleks_gylys
New Contributor

Hi all - saw some similar posts to this but nothing that does exactly what I need. I have two partitions, Restore (disk0s3/10GB) and MacHD (disk0s2/the rest of the free space). I need a script that will resize the Restore Partition to 25GB without touching the MacHD. Problem is, when I use resizeVolume it messes up the GPT, and throws up an error "MediaKit reports partition map too small". Trying to use gpt to fix/recreate it but it doesn't work. Here is what my script say right now:

diskutil umount /dev/disk0s3
gpt -r show /dev/disk0
gpt remove -i 3 /dev/disk0 #errors are thrown up around here...
gpt create -f /dev/disk0s3
gpt add -i 3 -s 52428800 /dev/disk0s3
diskutil resizeVolume /dev/disk0s3 25G

What am I missing? Sorry, I am more or less a script n00b

2 REPLIES 2

aleks_gylys
New Contributor

I was able to find a more roundabout approach to this: merge the partitions then break them back out. I will be expanding this script to including checking the current size of both partitions and turning it into a policy to push out new restore bases to all my managed clients with more available space for caching packages.

diskutil eraseVolume JHFS+ Restore disk0s3
diskutil mergePartitions JHFS+ Macintosh HD disk0s2 disk0s3
diskutil resizeVolume "/Volumes/Macintosh HD" 80% JHFS+ "Restore" 15%
bless -mount /Volumes/Macintosh HD -setBoot

L-JAMF
New Contributor

There is an open source utility called GParted that can run from a bootable cd ISO image (download link here: http://sourceforge.net/projects/gparted/files/gparted-live-stable/0.16.1-1/gparted-live-0.16.1-1-i486.iso ). On an iMac running Mac OS 10.7.5 I was able to boot to this CD and run the GParted utility. The GParted (Gnome Partition Editor) immediately detected that the GPT table was too small and offered to fix automatically. I allowed it to proceed, removed the bootable CD, and booted back into the Mac OS 10.7.5 installation from disk and then I was able to easily expand the partition without the MediaKit error message that the GPT map was too small. Backup your system first just in case, and good luck !