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
- 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.
- 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.
- 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:
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.).
- 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.
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.
- 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).
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.
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.
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.
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.