How to partition a hard drive in OS X using Core Storage

HardDriveIconXWhen you set up an external drive for use with your Mac, you may wish to partition it for various uses. For instance, you might want to isolate automatic Time Machine backups from manual ones. The classic way to do this on a single drive is to use Disk Utility to partition it, where you split the drive into two or more logical volumes that the system sees as separate file systems. Since OS X supports Apple’s CoreStorage volume management technology, if you wish to do this then you can do so via classic partitioning, as well as through CoreStorage.

Classic Partitioning

To partition your drive using the classic method, you can easily do so in Disk Utility by selecting the drive device and then choosing the Partition tab. In here, you can select the number of desired partitions from the drop-down menu, resize them according to your needs, and then click Apply to create your separate disks.

CoreStorage Partitioning

Classic partitioning will be the quickest and easiest approach for most people; however, because CoreStorage is present, you can also use this to manage your partitions, apply encryption to secure them, and even combine the storage of multiple disks to create one partition out of them. In this tutorial I will be mimicking classic partitioning, and split a drive into two partitions, both which will be encrypted:

  1. Get the drive’s identifier, by selecting the drive device in Disk Utility and pressing Command-i. You can also use the following Terminal command if you are familiar with its layout. The drive device ID will be something like disk2, disk3, etc. For this tutorial, I will use “disk2” as the drive device.
    diskutil list
  2. Now open the Terminal and run the following command. This will create the logical volume group for the device. This is basically combining the physical hardware to offer communal storage for the creation of individual volumes. In this case, only one physical disk is used (disk2) and the volume group name is “Backups” because for this purpose I am creating two separate partitions for my Time Machine backups:
    diskutil cs create Backups disk2
  3. Now run the following command to see the new logical volume group, which should show an list of the physical volumes under the new logical volume group’s name. This command just confirms the group has been made correctly and is available:
    diskutil cs list
  4. Now you need to create the first volume on the disk, which can be done by the following command. This specifies the group by its name, tells it that we are creating a journaled HFS+ partition (jhfs+) and are calling it “Retina MBP.” The volume will be using 50% of the group’s available storage. The last component “-stdinpassphrase” will require you enter a password (it will not be shown when typed), and this will subsequently encrypt the volume. Note that after doing this, the volume may mount and OS X will ask for your password to unlock the volume:
    diskutil cs createVolume Backups jhfs+ "Retina MBP" 50% -stdinpassphrase
  5. Now create the second partition in a similar manner, but note that instead of using 50%, we are using 100% of the available space (the remaining half that was not designated when creating the first volume). In this instance, we are also naming this volume “17-inch MBP”:
    diskutil cs createVolume Backups jhfs+ "17-inch MBP" 100% -stdinpassphrase

When these commands are done, the Core Storage drive will be fully created and available for use as a pair of encrypted volumes. You can now use them for whatever you want, be it backups, or storing libraries of sorts, or just as a general storage location. Note that being a CoreStorage drive means that while it can support encryption, and its available space can include physical storage on other disks, you will only be able to access this on a system that supports CoreStorage, which so far is OS X.

In this scenario, I created two volumes to be used as separate backup locations for my Macs on the same device, but since only one will apply to any of my two systems that I am using, it may be useful to prevent the unneeded drive from mounting. This can be done using the fstab file, by specifying the unique identifier (UUID) for the desired drive along with mounting conditions that will prevent it from automatically mounting. I discuss how to do this in depth in this article on creating and editing the fstab file.

4 thoughts on “How to partition a hard drive in OS X using Core Storage

  1. Noonan Mike

    This article begs for another discussion about how to add another physical disk to the group and how the allocation of space from the allocation of the existing logical volumes are applied or not to the new disk. Also an article about how to add/delete other logical volumes to the existing set of logical volumes and how their allocations are manifested across the devices would be interesting.

  2. mrmogimagoo

    How do i partition a 2 TB hard drive that has no OS but has one partition containing data and about 500 GB free space ?

    It seems to me that if i start to add a second partition the entire 2 TB will be erased.

    1. Lloyd

      The latest version of iPartition (at work and don’t remember exactly how to spell the company name – Coriolis, I think) will allow you to select the entire drive and locate as segments on a disk all of the existing partitions (more than you think). You can then use the line defining the existing contents and you can visually identify your limit of free space. Pretty much like LaCie’s old Silver Lining. You can then add a secont partition. Should take about an hour or so.

      The program works. Is safe. And makes a lot more sense when used than my explanation. Been using it for a few years.

  3. Strod

    One small comment for those trying to follow the examples:

    Some of the commands have names enclosed in double quotes such as “Retina MBP” and “17-inch MBP”. Note that while this site renders the double quotes as the “curly” version, you should actually use the straight version.

    The double curly quotes are the ones that have different versions for opening and closing that in a US English keyboard can be typed as Option-[ and Option-Shift-[. The straight double quotes are typed as Shift-‘ (the single-quote key between the semicolon and the enter/return key).

    Unfortunately, some systems replace the straight double quotes with the curly versions, a feature called “smart quotes”. But when you type commands in the Terminal you almost always want the straight type, and that’s the case here.

Comments are closed.