October 1, 2014

Non-Destructively Resize an Existing Drive with CoreStorage

CoreStorage Series

After I moved my iMac move volume to an SSD, I was left with an internal hard disk drive full of data. Rather than blowing away and start again, I decided to repartition it using CoreStorage. My next step was to resize my existing drive to make room for a new logical volume. CoreStorage can resize a drive non-destructively, moving existing data aside and clearing capacity for other uses.

Preliminary Steps

Before you can begin to resize a volume, you must convert the disk to CoreStorage as I previously discussed. You should also reboot the Mac to make sure the CoreStorage volume is up and running, and it probably wouldn’t hurt to do a quick volume check in Disk Utility.

It is also important to know how much data is currently stored on the volume to be resized: This is the minimum size! I used the “df -k” command to see the “Used” space on my drive, “Macintosh HD”.

Use “df -k” to see the current utilization of the drive to be resized

As you can see in this screenshot, the drive contained exactly 814571572 kilobytes of data, which converts to 776 GB in base 2. To be on the safe side, I decided to resize this drive to 850 GB, leaving approximately 150 GB for the new volume I would create later.

Get the UUID of the Logical Volume

We must first determine the UUID of the Logical Volume we wish to resize. I used the “coreStorage list” command of Diskutil to determine this.

diskutil corestorage list

I have highlighted the Logical Volume UUID and current size

It is important to get the correct UUID: Each element in the CoreStorage stack (Logical Volume Group, Physical Volume, Logical Volume Family, and Logical Volume) has its own UUID and we must use the correct one for each command!

diskutil coreStorage resizeVolume

Now we will resize our volume.

Note that this is an undocumented CoreStorage command: Although Apple created this function and the Diskutil command includes help text for it, it is not supported or endorsed by Apple. They even left it off the list of available options when you type “diskutil coreStorage”!

Although resizeVolume is undocumented, it has always worked fine for me. After a year of experimentation, I feel comfortable trusting it to my own data.

The diskutil coreStorage resizeVolume command takes as arguments the UUID of a Logical Volume to be resized and the desired capacity. As noted above, your target capacity should be greater than the data stored on the volume!

diskutil coreStorage resizeVolume ED316C9A-0483-4CAF-993C-78595C61FE55 850g

The CoreStorage resizeVolume command includes a dynamic progress bar

I decided to resize my 1 TB “Macintosh HD” volume to 850 GB so I could create a new volume for use by Final Cut Pro. The resize command took about 35 minutes on my iMac’s 7200 rpm Seagate internal drive – your progress will vary dramatically based on the interface speed, drive speed, and amount of data to be relocated!

I left my computer to work in peace and found this when I returned

Check out your newly resized volume!

Once the resizeVolume command was finished, I examined the volume to see if it had resized correctly. Sure enough, the volume was now 850 GB in size, leaving about 150 GB free in the Volume Group.

My “Macintosh HD” volume was successfully resized to 850 GB

I also used “df -k” to see the new drive size, and even popped up Disk Utility to examine it. Everything worked fine!

  • dubs

    I used a resize Funktion discovered in Diskutil GUI. Seen that in Diskutil there is a kinda “grab area” where you create the Partitions. I had 1 Partition set on a 1TB HD when i seen it so i moved that “grab area” upwards and after apply i was seing free space where it was possible to create a new Partion with.

  • http://twitter.com/handleym99 Maynard Handley

    dubs is correct. If all you want to do is shrink an existing partition, you can do this using the Disk Utility GUI without involving either Core Storage or the command line.

    You choose the disk (DISK, not volume) of interest in the Disk Utility GUI, and click on the Partition tab which appears. You will see a partition map of your disk (which usually will show a single partition covering the entire disk). Grab the bottom of the rectangle corresponding to the partition, drag it upwards, and the partition will shrink. Obviously the UI will ask if you are sure, and if you say yes, will move files as necessary to make this happen.

    The same UI can be used in the obvious way to choose partitions and delete them, to create new partition in the free space that is created, and to grow partitions.

    This capability came with 10.7 and was used by everyone who upgraded from10.6 to 10.7 behind the scenes — part of the 10.7 upgrade was to shrink your boot partition slightly (by about 650MB) so as to create the Recovery partition. It’s clear that it doesn’t use Core Storage to do the work, because assuming this is all you did, you will not have created any Core Storage visible entities at the end of the process.

  • André Lucas

    Thanks, this got me out of jail when Boot Camp crashed mid-resize!

  • http://twitter.com/jspeh J Riggs

    Thanks for this… I have CoreStorage set up on my MacBook Pro so my 500GB HDD and 60GB SSD work as a hybrid drive. However, I’ve decided to install Windows, too, and wasn’t sure how to finagle the partions around (or if it was even possible). From what you shared, I think I’m going to do a backup and then try it… I’ll let you know how it works!

  • BrS

    This does not work on Core Storage volumes. Those can only be resized from the command line.