Mirror Disks After Install
Disk mirroring, where data is written to two disks simultaneously, is a great low cost method to protect against single-disk failure and improve read-intensive performance. Apple’s Disk Utility provides an easy way to set two disks up as a RAID mirror at installation, but once the operating system has been installed OS X can’t mirror an existing drive without reformatting and reinstalling.
What began as a missed opportunity in Tiger became a buggy implementation in Leopard, and in the past year the procedure for mirroring an existing volume has changed no less than three times. This is an essential feature for storage management, and it inexplicably still only works from the command line. While not the most convenient, this method works with any Tiger or Leopard machine.
This process has the potential to destroy all the data on your machine, so make sure you have a current backup of the drive you’re going to mirror and confirm the backup is both restorable and bootable. Next, if you’re mirroring your existing startup disk, you’ll need to boot off an installation DVD or external drive for the first part of the operation. When you’re ready to proceed, type the following into the Terminal:
diskutil list
This will produce a listing of the attached disks, along with their types, names, sizes, and identifiers, like so:
/dev/disk1
#: type name size identifier
0: Apple_partition_scheme *465.8 GB disk1
1: Apple_partition_map 31.5 KB disk1s1
2: Apple_HFS Server Disk 465.6 GB disk1s2
Use the name of the volume you wish to mirror to find it’s identifier. If your machine only has one internal hard drive, for instance, the identifier of your boot volume will most likely be disk1s2, the second slice (after the partition scheme and map) of disk 1. Once you’ve determined which disk you’re working with, type the following, replacing IDENTIFIER appropriately:
sudo diskutil enableRAID mirror IDENTIFIER
If all goes well, the disk will unmount, reappearing in the Finder a moment later along with “The disk has been converted into a RAID” reported in the Terminal. At this point you can insert the additional disk you wish to use in the mirrored RAID array (assuming it’s not installed already), then reboot the machine off the original drive.
Now when when you run diskutil list from the Terminal you should see two new listings, one for the new virtual RAID array (the one without slice information) and the other for the additional physical disk you installed.
/dev/disk2
#: type name size identifier
0: Apple_HFS Server Disk *465.6 GB disk2
/dev/disk3
#: type name size identifier
0: GUID_partition_scheme *465.6 GB disk3
1: EFI 200.0 MB disk3s1
2: Apple_HFS New Disk 465.4 GB disk3s2
Now with the necessary identifier information, you can assign the physical disk to the mirrored RAID array, replacing RAIDARRAY with the RAID volume (in our example disk2) and NEWDISK with the hard drive being added (here disk3):
sudo diskutil addToRAID member RAIDARRAY NEWDISK &
How long the RAID mirror takes to build depends on how much data is on the original volume, but the ampersand at the end of the command tells it to run in the background. When the process is completed you’ll have two fully mirrored and redundant disks, built from your existing installation without ever having to erase the original volume.
