OT - anyone know of a way to non-destructively auto resize an OS X boot partition?

acdesigntech
Contributor II

The key here is automatically resize the partition, and to do it non-destructively (i.e.: no repartitioning the drive in order to resize - and no launching an app and having someone do X, Y, and Z).

Here's the scenario - We have 3 generations, if you will of mac images here: an image that sized boot partitions at 40GB, an image that sized at 60GB, and the current one that sizes at 100GB. I would like to detect the size of the boot partition, user data partition, and free space, and determine if there is enough space to resize to 100GB on the boot partition. I can do this easily enough using diskutil and repartitioning the drive, but I want to do this non-destructively, because we have nowhere to store that much user data while we repartition, and we don't have the time to copy that much data off the drive anyway.

Currently we use iPartition as a singular, manual resolution for the occasional Mac that we find that has run out of drive space, but this is time consuming and requires me to send a tech out to do the work. My imaging workflow does not repartition disks when reimaging in the case that we want to preserve user data, however when that is not the case the workflow resizes the boot partition to 100GB and user data partition to 0b (effectively using the rest of the space), so upon (re)provisioning a Mac, the 100GB partition problem is solved.

I reached out to Coriolis Systems and currently they do not have a way to automate iPartition, except maybe using services and automator, but that's not a supported solution and they have no notes on how to get something like that set up, so I was wondering if anyone has run into this issue and resolved it, and how? We're mostly concerned because we'll be rolling CS6 out here in about 6 months and about a third to half our macs will fail the available drive space test for the roll-out.

6 REPLIES 6

Nix4Life
Valued Contributor

Since you are familiar with diskutil try the resizeVolume option( will resize non-destructively. I used this all the time for eDrive partition) then look at stevewoods reply to partition script

franton
Valued Contributor III

Word of Caution!

The resizeVolume command will work, but it's reliant on the drive not being too fragmented. I've had major issues with it not sizing down partitions to the required size before. It turned out there wasn't enough contiguous free space to do it.

acdesigntech
Contributor II

I've not been able to get disk utility to resize the OS partition in the past. Consider the following from oreilly.com:

Example 2: Suppose you have two partitions on your Mac hard drive, i.e. first ‘Macintosh HD’ and the second ‘Lion Partition’. You reduced the size of Macintosh HD. Next, you need to add the freed up space to the Lion Partition.

Problem
You cannot expand Lion Partition by dragging its upper end.

Solution
You can change the partition size only from where it ends. For expanding your Lion Partition using Disk Utility, you can follow the below mentioned procedure:

Note: Before starting with the process, you should backup all the data to an external hard drive.

You reduced the size of first partition and this resulted in some free space between the two partitions. Create a new partition with this space and give it a different name.

The boot partition comes before the data partition in the table. Thus freeing up space on the data partition only ever frees up data at the END of the table, never between the two partitions - otherwise i should be able to concatenate the free space and the boot partition... The oreilly article, http://answers.oreilly.com/topic/4341-what-are-the-problems-faced-with-disk-utility-while-partition-..., does explain how to do the reverse, but i need to shrink the second and grow the first. iPartition can do it, so I know it's possible.

acdesigntech
Contributor II

found this thread too, which is trying to accomplish the same thing: https://jamfnation.jamfsoftware.com/discussion.html?id=5882. However it ends up removing the second partition entirely, merging the two, then repartitioning :(

I wonder if there's a hidden command list in diskutil that would actually MOVE partitions. If I could free up space, then MOVE that space between the boot and work partitions, I would be able to add that space onto the boot partition. Time to dig into strings....

UPDATE:
possibly 'gpt migrate' - but I only have a 10.6 machine right now, and it's telling me that migrate is an unknown command. I got it by running a strings gpt command, and it showed migrate in the list of other valid verbs you can use. Anyone have any experience with this, or is it still unknown in Mountain Lion (won't be able to test with ML until tomorrow at work)?

franton
Valued Contributor III

I know both Greg Neagle and Rich Trouton have been doing some digging in that regard of hidden commands. Might be worth a look at their blogs.

acdesigntech
Contributor II

Bringing this blast from the past up. I have a serious case of CRS right now and just remembered I had posted something about this

so far, no luck on a 10.8 Mac either. I'm trying 10.9 tomorrow...