This article explains how to use Terminal to create and manage striped RAID arrays in OS X, since the El Capitan version of Disk Utility has been stripped of its RAID capabilities.
About the Mac OS and Multiple RAID Types
Since its early days, the Mac operating system has supported multiple RAID types using AppleRAID software that is part of diskutil, the command-line tool used for formatting, partitioning, and repairing storage devices on a Mac.
Information in this article applies to creating a RAID 0 (Striped) array using Terminal in macOS Sierra (10.12) through OS X Lion (10.7).
Until OS X El Capitan, RAID support was built into the Disk Utility app, which you could use to create and manage RAID arrays. Apple dropped the RAID support in the El Capitan version of the Disk Utility app but kept AppleRAID available for users who were willing to use Terminal and the command line. Apple returned RAID creation to Disk Utility in macOS High Sierra.
Before You Begin
Using Terminal to create a RAID 0 array, also known as a striped array, is an easy process that can be performed by any Mac user. No special skills are necessary, although you may find the Terminal app a bit strange if you’ve never used it before.
The Importance of Backups
Striped arrays provide a speed increase, but they also increase the possibility of failure. A failure of any single drive that makes up a striped array causes the entire RAID array to fail. There’s no magical method to recover data from a failed striped array, which means you should have a good backup system that you can use to restore data should a failure of the RAID array occur.
What You’ll Need
AppleRAID supports striped (RAID 0), mirrored (RAID 1), and concatenated (spanning) types of RAID. Before you create a RAID 0 array, you need:
- Two or more drives that can be dedicated as slices in your striped RAID array.A current backup. The process of creating a RAID 0 array eras all the data on the drives used.
You can use just about any drive type, including hard drives, SSDs, or USB flash drives. It’s a good idea for the drives to be identical, both in size and model, although this is not a strict requirement of RAID 0.
Use Terminal to Create a RAID 0 (Striped) Array
This example uses two disks as slices of the RAID 0 array. Slices are the nomenclature used to describe the individual volumes that make up the elements of any RAID array.
If the drives you’re planning to use haven’t yet been formatted as a single volume using OS X Extended (Journaled) as the file system, do that. The method you use varies depending on your operating system:
Format a Mac’s Drive Using Disk Utility (OS X El Capitan or later)
Format a Mac’s Drive Using Disk Utility (OS X Yosemite or earlier)
- Launch Terminal, located in Applications > Utilities.
- Enter the following command at the prompt in Terminal. You can copy/paste the command to make the process easier:
- diskutil list
- This causes Terminal to display all the drives connected to your Mac, along with the drive identifiers you need when creating the RAID array. Your drives are displayed by the file entry point, usually /dev/disk0 or /dev/disk1. Each drive has its individual partitions displayed, along with the size of the partition and the identifier (the name).
- The identifier will likely not be the same as the name you used when you formatted your drives. This example uses two drives titled Slice1 and Slice2. In the image, you can see that Slice1’s identifier is disk2s2, and Slice2’s is disk3s2. It’s the identifier that you use to create the RAID 0 array.
- Your identifiers may be different, so be sure to replace the example identifiers in the command with the correct ones for your Mac.
- The command we’re going to use is in the following format:
- Diskutil appleRAID create stripe NameofStripedArray Fileformat DiskIdentifiers
- NameofStripedArray is the name of the array that will be shown when it is mounted on your Mac’s desktop.
- FileFormat is the format that will be used when the striped array is created. For Mac users, this will likely be hfs+.
- DiskIdentifers is the identifier names you discovered using the diskutil list command.
- Enter the following command at the Terminal prompt. Be sure to change the drive identifiers to match your specific situation, as well as the name you want to use for the RAID array.
- Diskutil appleRAID create stripe FastFred HFS+ disk2s2 disk3s2
- Terminal displays the process of building the array. After a short time, the new RAID array mounts on your desktop, and Terminal displays the text “Finished RAID operation.” You’re all set to start using your speedy new striped RAID.
- How to Delete a Striped RAID Array Using Terminal
- At some point, you may need to delete the array. Once again, you use the Terminal app combined with the diskutil command line tool to delete the RAID 0 array and return each RAID slice for use as individual volumes on your Mac.
- Deleting your striped array causes all data on the RAID to be erased. Make sure you have a backup before proceeding.
- Launch the Terminal app located at Applications > Utilities.
- The example for creating a RAID 0 array resulted in a RAID array named FastFred. The name of your RAID will be different.
- At the Terminal prompt, enter the following, being sure to replace FastFred with the name of the striped RAID that you want to delete.
- Diskutil AppleRAID delete FastFred
- The delete command unmounts the RAID 0 array, takes the RAID offline, and breaks the RAID into its individual elements.
- What doesn’t happen is also important. The individual drives that made up the array are not remounted or properly formatted. Use Disk Utility to reformat the drives so that they are once again usable on your Mac.
Launch Terminal, located in Applications > Utilities.
Enter the following command at the prompt in Terminal. You can copy/paste the command to make the process easier:
diskutil list
This causes Terminal to display all the drives connected to your Mac, along with the drive identifiers you need when creating the RAID array. Your drives are displayed by the file entry point, usually /dev/disk0 or /dev/disk1. Each drive has its individual partitions displayed, along with the size of the partition and the identifier (the name).
The identifier will likely not be the same as the name you used when you formatted your drives. This example uses two drives titled Slice1 and Slice2. In the image, you can see that Slice1’s identifier is disk2s2, and Slice2’s is disk3s2. It’s the identifier that you use to create the RAID 0 array.
Your identifiers may be different, so be sure to replace the example identifiers in the command with the correct ones for your Mac.
The command we’re going to use is in the following format:
Diskutil appleRAID create stripe NameofStripedArray Fileformat DiskIdentifiers
NameofStripedArray is the name of the array that will be shown when it is mounted on your Mac’s desktop.
FileFormat is the format that will be used when the striped array is created. For Mac users, this will likely be hfs+.
DiskIdentifers is the identifier names you discovered using the diskutil list command.
Enter the following command at the Terminal prompt. Be sure to change the drive identifiers to match your specific situation, as well as the name you want to use for the RAID array.
Diskutil appleRAID create stripe FastFred HFS+ disk2s2 disk3s2
Terminal displays the process of building the array. After a short time, the new RAID array mounts on your desktop, and Terminal displays the text “Finished RAID operation.” You’re all set to start using your speedy new striped RAID.
How to Delete a Striped RAID Array Using Terminal
At some point, you may need to delete the array. Once again, you use the Terminal app combined with the diskutil command line tool to delete the RAID 0 array and return each RAID slice for use as individual volumes on your Mac.
Deleting your striped array causes all data on the RAID to be erased. Make sure you have a backup before proceeding.
Launch the Terminal app located at Applications > Utilities.
The example for creating a RAID 0 array resulted in a RAID array named FastFred. The name of your RAID will be different.
At the Terminal prompt, enter the following, being sure to replace FastFred with the name of the striped RAID that you want to delete.
Diskutil AppleRAID delete FastFred
The delete command unmounts the RAID 0 array, takes the RAID offline, and breaks the RAID into its individual elements.
What doesn’t happen is also important. The individual drives that made up the array are not remounted or properly formatted. Use Disk Utility to reformat the drives so that they are once again usable on your Mac.
Get the Latest Tech News Delivered Every Day