How to make a custom CoreStorage drive in OS X

The CoreStorage volume manager behind Apple's Fusion Drive can be used to create your own spanned volumes in any Mac running Lion or later.

CoreStorage is Apple's volume manager that provides an interface between the OS and physical volumes on the drive. It was introduced in OS X Lion for its full-disk encryption options with FileVault 2, but in addition allows for volume spanning, where multiple drives in the system can be combined into one logical volume for the OS to use.

The CoreStorage volume-spanning feature not only increases a single volume's storage beyond the capacity of a single drive, it also prioritizes storage to the primary drive in its logical volume. This means that if you use an SSD as the primary drive, then as with Apple-configured Fusion Drives you will get fast data access when accessing frequently-used files.

This feature is the basis of Apple's new Fusion Drive technology ; its presence in OS X 10.7 and later allows you to create custom Fusion Drive setups and implement them on Mac systems that did not ship with a Fusion Drive configuration. However, while Apple's Disk Utility can be used to repair problems with existing Fusion drives, adequately managing the CoreStorage volume currently requires the use of Terminal commands. As a result, for now if you would like to set up a custom spanned-volume in OS X, including using an SSD in a homemade Fusion Drive, you will have to use the following steps:

Making the CoreStorage drive

  1. Get two or more drives
    To create a spanned volume with CoreStorage, you will need two storage drives (ensure one is an SSD for Fusion Drive performance). Internal drives are preferred for the most stable results and will be required for best Fusion Drive performance, but external drives can also be used.
  2. Format the drives with a GUID partition table and one partition
    Open Disk Utility in OS X, followed by selecting the drive device (listed above the volume name) and using the Partition tab that appears to select one partition for the drive. Then click the "Options" button and be sure GUID is selected as the partition format to use. Apply these changes and perform this action for each drive you are going to include in the hybrid drive.
  3. Partitioning drives in Disk Utility
    Give each drive one partition and set it to have a GUID partition table. Screenshot by Topher Kessler/CNET
  4. Locate the physical drive identifiers
    Find the hardware identifier labels for both the first (main) drive, and the partition/volume on the remaining drives to combined in the CoreStorage volume. These will be something like "disk1" for the main drive, and "disk2s2" for the remaining drives volumes (the numbering may not necessarily be in order). While you can get information on the drives in Disk Utility to find this information, a thorough way to get all of these in one shot is to run the following command in the Terminal:

    diskutil list


    In the output of this command, you will see each device and the partitions on it listed, along with the corresponding identifier. Drive devices will be simply disk0, disk1, disk2, and so forth, and the partitions on each will be denoted by their "slice" number (s1, s2, s3, etc.).
  5. Drive identifier labels in the Terminal
    The Terminal output should show the drive identifier labels here. Screenshot by Topher Kessler/CNET
  6. Create the logical volume group
    Open the Terminal and run the following command to create a logical volume group using the drive identifiers.

    diskutil cs create GROUPNAME disk1 disk4s2


    In this command, change "GROUPNAME" to be the name of the logical volume group. This can be any unique name and will not be the final name of the volume you see and use with your computer. Also note that the first drive identifier used is that for the primary drive (the SSD for Fusion Drive setups), and is the identifier for the device itself. The second identifier is a partition slice identifier from the second drive to add.

    This setup will have the CoreStorage volume manager take over the first drive and run it as its primary storage medium, and then append the secondary volume to it for extra storage media.

    Creating a CoreStorage volume group in the Terminal
    After the command is run, copy this UUID string for the volume group. Screenshot by Topher Kessler/CNET
    When this command is run, the Terminal will output some progress information, followed by outputting a UUID (unique identifier number) for the newly created volume group. This number will look like a series of capital letters and numbers in five groups separated by dashes, and is important for both creating and destroying usable volumes in the volume group.

    After this is completed, you can see the logical volume group structure by running the command "diskutil cs list" in the Terminal, which will output a tree showing the source volumes used for storage. There should be two that represent the drives you have added, listed underneath an entry for the logical volume itself.
  7. Logical volume lists in OS X
    Re-running the "diskutil cs list" command now shows the logical volume group (top) and the disks included in it (bottom). Screenshot by Topher Kessler/CNET
  8. Create a usable volume from the volume group
    Copy the UUID for the logical volume group from the previous command, and use it in the following command to create a usable volume out of the logical volume group.

    diskutil cs createVolume UUID jhfs+ VOLUMENAME 100%


    In this command, besides the UUID, replace VOLUMENAME with a name you would like the volume to be. As with any volume in OS X you can change its name at any time in the Finder, so what you use here is not important. The other components here are "jhfs+" which stands for the journaled HFS+ format, and "100%" instructs the volume to use all the available storage space (you can also specify the number of gigabytes or megabytes with "123G" or "123M" to only use a portion of the available space).

    Creating a usable CoreStorage volume.
    Running this command will create a usable volume in the logical volume group. Screenshot by Topher Kessler/CNET
    When finished the Terminal will output the UUID for the new volume, which will automatically mount in the Finder and be available in Disk Utility. If you re-run the "diskutil cs list" command to view the CoreStorage structure you will see the newly created volume now as part of the structure. At this point you should be able to encrypt the volume and partition it; however, do keep in mind that if you do, then as Apple outlines in its FAQ on the Fusion Drive, any new partitions will not be part of the logical volume group. Instead, these partitions will be directly on the secondary drive.

    NOTE: In addition to having the spanned volume, you can also make use of Apple's FileVault encryption options for the CoreStorage volume. To do so, run the following command in the Terminal:

    diskutil cs encryptVolume UUID


    In this command, the UUID is that for the newly created usable volume, and when run you will be prompted for a password to use for encrypting the drive. Keep in mind that this should be used only for data drives. If you want to encrypt the boot drive, then enable FileVault in the OS X Security system preferences.
CoreStorage volume tree in OS X
Re-runnign the "diskutil cs list" command will show the newly-created volume in the CoreStorage tree. Screenshot by Topher Kessler/CNET

Using and managing the drive

Once the spanned volume is created, then it can be used for standard storage, or you can install OS X to it and boot off of it.

If you have created the CoreStorage volume on external drives, then you can eject it and remove the drives as you normally would, but they will all have to be attached for the CoreStorage volume to be recognized and mounted properly. If you remove any while Disk Utility is open, then Disk Utility may show an error stating there is a disk error, and will offer you an option to fix it. Avoid doing so as this will result in the drives getting wiped and formatted as Disk Utility tries setting them up again.

Disk Utility CoreStorage error
Disk Utility may show this error if you eject the CoreStorage volume, so be sure to click "Ignore" to prevent formatting the drives and losing your data. Screenshot by Topher Kessler/CNET

One caveat to the CoreStorage volume is that it will not be easily managed in Disk Utility, as the volumes and devices that constitute the drive will be hidden by default. While you can enable the Disk Utility debug menu followed by enabling viewing of all partitions to access and erase the partitions and thereby force the CoreStorage volume to be destroyed, perhaps an easier way would be to use the Terminal. To do this, you will need to get the volume's UUID number again (obtained by using the "diskutil cs list" command), then place it instead of "UUID" in the following command:

diskutil cs delete UUID

When finished, the partitions that were used to make up the CoreStorage volume should be freshly formatted and available for you to use as conventional drive partitions.

CoreStorage volume in Disk Utility
The CoreStorage volume can be partitioned with Disk Utility, but its volumes are hidden by default so managing it is best done in the Terminal. In this image the CoreStorage volume is being partitioned into two volumes, though the second one (CSVolume 2) will only be on the secondary drive and be a conventional partition and not a CoreStorage partition. Screenshot by Topher Kessler/CNET

Since Fusion Drive setups combine two drives into one, people may wonder about how this compares to a software RAID setup that Apple has supported in Mac systems for years. The difference here primarily lies in the abilities and constraints of the drive-spanning technology. Both technologies combine drive storage into a single media platform on which you can create multiple logical volumes, but RAID options are built for speed as well as data protection with redundancy and parity, whereas Fusion Drive is built for prioritizing data to one drive and allowing for core encryption support. While some hardware RAID arrays offer encryption options in their RAID controllers, this is not available in Apple's software RAID.

While the Fusion Drive setup has many benefits, it does come with a few minor drawbacks. For one, fixing and managing the drive is so far not well supported in Disk Utility, resulting in the need for the Terminal to adjust it and set it up from scratch.

Additionally, as with any multidrive setup such as RAID arrays, more devices used means greater chance for one to fail and cause problems. While in RAID setups the use of parity information and redundancy can keep the system going and rebuild data from a faulty drive, this is not available in Fusion Drive. Therefore, as with any common storage solution, regular backups are highly recommended. However, unlike RAID arrays that are often configured with numerous drives, in most cases Fusion Drive setups will use only two drives so the chances of failure are still relatively slim.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Don't Miss
    Hot Products
    Trending on CNET

    HOT ON CNET

    Want affordable gadgets for your student?

    Everyday finds that will make students' lives easier: chargers, cables, headphones, and even a bona fide gadget or two!