Note: This article is replaced with http://krypted.com/mac-os-x/enabling-raid-mirrors-redux for Snow Leopard. Do not use these procedures for Snow Leopard or above as they are meant for 10.5 and below.
When you get an Xserve or one of the new Mac mini Leopard Server, it will come with the operating system on a single drive. In most cases, you’re likely gonna’ have a second drive in those devices. Most people are hopefully going to want to run a RAID1 on those drives. If so, many will simply choose to insert the disk, reboot and reinstall the operating system, using Disk Utility during the installation process to setup the RAID.
But you don’t have to. It’s three commands to convert a non-RAID volume into a RAID volume. Actually, it’s one command to do that, but keep readin’.
First up, find the lay of the land. Run diskutil with the list verb, which is going to show you all of the disks you have at your disposal along with their sizing, etc. For example:
In most cases you’re going to be booted to the volume you’re going to turn into a RAID and it’s likely to be disk0. Therefore, assuming that the volume is disk0 use the diskutil command with the enableRAID verb (which does basically what the name implies) and then list the type of RAID (in this case we’re going to use mirror as a stripe would require a complete rebuild) and then list the device (in our case again, this is disk0). So the complete second command, which will enable the RAID is as follows:
diskutil enableRAID mirror disk0
At this point you have a drive that wants to be a mirror but isn’t (without a second member). So to add the second drive (the beauty to our geek) go ahead and use the diskutil command with the repairMirror verb. Here, you will “repair” the mirror using the source (so-to-speak) followed by the destination (again, so-to-speak). Here we’re going to assume disk0 from earlier followed by disk1:
diskutil repairMirror disk0 disk1
Now wait. And wait and wait and wait. Then it will be done and you’ll be able to move on to other tasks. For example, if you have an Xserve you can move your journal to that SSD drive or resize a partition and use the free space for something else, effectively disassociating operating system from actual data sets. Overall, this is a huge time saver in some setup scenarios and can help to be able to spend more time on other important things, like workflow.
Finally, this can easily be scripted; however, when you do so keep in mind that the changes that you make programatically make a lot of assumptions and if you have servers that aren’t identical (or have existing data sets somewhere), that it can be more dangerous than simply typing the three commands in sequence (otherwise I’d of written a GUI app to do it a long time ago).
Note: I wasn’t sure where I initially learned how to do this since it was 5 years ago. My apologies for not initially looking up the reference and my hat off to Josh for teaching me how to do something that has saved me countless hours over the past few years:
While I’m at it, thanks to everyone else. Sorry if I forget to acknowledge anyone in books, articles, etc. It is never intentional, I assure you.