In OS X 10.7 Lion, Apple switched its FileVault encryption technology from relying on disk images, to using a volume management technology called CoreStorage. This provides a layer between the OS and the physical partitions on a local drive, allowing not only full-disk encryption options, but also spanning of a single logical volume across multiple physical partitions.
This technology is the backbone of Apple’s Fusion Drive, and while it is offered as an OEM option for some of its Mac systems, if you have multiple drives on your Mac, then you can not only create your own spanned volume, but also create your own Fusion Drive.
When two drives are combined into one, CoreStorage will prioritize the faster one, so if an SSD and mechnaical hard drive are paired in this manner, then the system creates a Fusion Drive, where commonly-accessed files will be stored on the faster SSD, but the entire drive will include the space available on the larger mechanical drive.
This technology offers great potential for those who know how to make use of it; however, Apple has not provided an easy way to create or managing CoreStorage volumes.
As such, for now if you would like to create a homemade Fusion Drive or otherwise set up a custom spanned volume in OS X, then you will have to use the following steps:
1. Get two or more drives
To create a spanned volume with CoreStorage you will need two storage drives. Preferably use internal drives for their stability and speed, but you can also use external drives, provided they are kept attached and in working order.
2. Format the drives with a GUID partition table and one partition
Open Disk Utility in OS X, and then select the drive devices. When you do this, a Partition tab will appear. Click this tab and then select 1 partition for the drive. Then click the “Options” button and be sure GUID is selected as the partition format to use. Do this for each drive you are going to include in the spanned volume.
3. Locate the drive identifiers
Find the identifiers 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. 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, etc, and the partitions on each will be denoted by their “slice” number (s1, s2, s3, etc.).
4. Create the logical volume group
This step may take a while to complete. Open the Terminal and run the following command to create a logical volume group using the drive identifiers.
diskutil cs create GROUPNAME disk1 disk2s2
In this command, change “GROUPNAME” to be the name of the logical volume group, which can be anything you choose, and will not be the final name of the drive you see mounted in the Finder. Also keep in mind 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 and does not end with an “s#” number. The second identifier is a slice identifier for the partition of the second drive to add.
This setup will result in CoreStorage taking over the first drive and run it as its primary storage medium, and then append the secondary volume to it for extra storage.
When this command is run, the Terminal will show the progress of the conversion, followed by generating a UUID (unique identifier number) for the new logical volume group. This UUID 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 following command in the Terminal, to show a tree of the source volumes used for storage.
diskutil cs list
In the output of this command, you should see the two physical volumes listed as input, followed by the combined output of the logical volume with information such as the label you gave, its UUID, and size.
5. Create a usable volume from the volume group
With your logical volume group made, you simply have created a large empty storage medium, and like a blank disk, now need to create a volume on it. This can be done with the following command, to create a disk that spans all of the available logical media:
diskutil cs createVolume UUID jhfs+ VOLUMENAME 100%
In this command, replace “UUID” with the UUID from the “disktuil cs list” you just ran, and replace VOLUMENAME with a name you would like the volume to be. You can change the volume name at any time in the Finder, so it does not matter what you use here. The other components here are “jhfs+” which stands for the journaled HFS+ format, and 100% is to use all available storage space in the logical volume.
When finished creating the volume, the command will print out the new volume’s UUID, which will mount in the Finder and be available in Disk Utility. At this point you should be able to encrypt the volume by running 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.
If desired, you can also partition the drive; however, keep in mind that any new partitions will not be part of the logical volume group, and instead will be physical partitions on the secondary drive.
Once the spanned volume is created, then you can use it either for standard storage, or you can install OS X to it and boot off of it.
If you have created the CoreStorage volume using external drives, then keep in mind while you can eject it and remove the drives as you normally would, will all have to all be attached in order for the CoreStorage volume to be recognized and mounted properly. Without this, Disk Utility will throw an error when interacting with them. Avoid doing so as this will result in the drives getting wiped and formatted as Disk Utility tries setting them up again.