Ever wished that you had setup your Mac OS X Server with a boot RAID before you installed everything? Afraid that making a RAID mirror now will require you to backup, format, and restore?
Read on to see how to create a RAID mirror without formatting your drive.MAKE SURE YOU HAVE A GOOD BACKUP BEFORE YOU ATTEMPT THIS!
If you’ve ever wanted to add the redundancy of a RAID, but didn’t want to go through the backup, format, restore dance; this is your lucky day. The command line version of the drive section of Disk Utility has a nifty verb, ‘enableRAID’. What you can do with this is take an existing disk and turn it into a degraded RAID set. Then you can use Disk Utility or diskutil to add and rebuild a second member of the set.
It’s even pretty easy to do.
- Make sure you have a good backup. We are going to be re-writing the partition map of your disk. If something were to go wrong you could loose all of your data. That said, this seems to be pretty reliable.
- If you want to mirror your boot device you will need to startup off of something else first. Next open the Terminal and type
diskutil list. You will get some output like this:
[macxmv2:~] admin% diskutil list
#: type name size identifier
0: Apple_partition_scheme *172.6 GB disk0
1: Apple_partition_map 31.5 KB disk0s1
2: Apple_Driver43 28.0 KB disk0s2
3: Apple_Driver43 28.0 KB disk0s3
4: Apple_Driver_ATA 28.0 KB disk0s4
5: Apple_Driver_ATA 28.0 KB disk0s5
6: Apple_FWDriver 256.0 KB disk0s6
7: Apple_Driver_IOKit 256.0 KB disk0s7
8: Apple_Patches 256.0 KB disk0s8
9: Apple_HFS Server HD 172.5 GB disk0s9
#: type name size identifier
0: Apple_partition_scheme *172.6 GB disk1
1: Apple_partition_map 31.5 KB disk1s1
2: Apple_Driver43 28.0 KB disk1s2
3: Apple_Driver43 28.0 KB disk1s3
4: Apple_Driver_ATA 28.0 KB disk1s4
5: Apple_Driver_ATA 28.0 KB disk1s5
6: Apple_FWDriver 256.0 KB disk1s6
7: Apple_Driver_IOKit 256.0 KB disk1s7
8: Apple_Patches 256.0 KB disk1s8
9: Apple_HFS SecondHD 172.5 GB disk1s9
The main thing we are looking for here is the device name of our disks. Let’s pretend we are going to make a mirror of our boot disk, disk0.
- We’ve decided that we want to create a mirror of disk0 so type
diskutil enableRAID mirror disk0and the drive in question will vanish from the desktop! Wait for it… Wait for it… Is that fear I see in your eyes soldier?!? Are you thinking about your backup yet? Pop! The drive should remount after 30 seconds or so with it’s contents intact.
(It may come back quicker on your Mac, I tested this procedure on a G4 500 with two 18GB SCSI drives. Bleh…)
- Now that your drive is back you can rebuild the new RAID set with either with a
diskutil repairMirror (RAID device name) (Bad slice) (Good member) (New member)or just open up Disk Utility, drag and drop, and then watch the pretty progress bar.
If you mirrored your boot device you can startup off of it and get back to work before you rebuild since you can rebuild in the background now. In fact, when writing this tip I was letting the boot RAID rebuild in the background of a G4 AGP 500 running Mac OS X 10.3.4 client. I then followed up with a G4 XServe running 10.3.5 Server.
(It’s occured to me that I should let you know that the rebuild takes a really, really long time. Disk Utility warns you about this, but it doesn’t drive the point home with enough force. When I rebuilt my RAID for this article it took over an hour for less than 8 GB of data to mirror. This is a good reason to reboot and rebuild in the background as any I can think of!)
And that’s really all there is to it! Now when a drive dies you get to decide when to replace it. If you have a Xserve you don’t even need to shutdown to swap drives and rebuild your boot RAID.
Things to remember