Probably you know this situation: you buy an Xserve with multiple drives and want to mirror your boot drive.
If you set up your machine, Mac OS X Server comes pre-installed on a single drive.
Now you have two options to create the mirrored boot drive:
- mount the Xserve in target mode on a second machine using FireWire and then use Disk Utility to mirror two drives. This way you delete the pre-installed Mac OS X Server software and have to reinstall it afterwards.
- Set up your server software on a single drive and then –after this is finished– make this drive part of a RAID mirror.
While the first option is common knowledge, this article is meant to explain the second option.
Another reason why you would probably like to promote a single disk to be part of a mirrored drive set, is that during operation you can increase your data security by adding a second drive without interrupting your workflow too much.
Here’s how you do this.
First, open a Terminal window and find out what your disks’ names are:
odmaster:~ root# diskutil list
/dev/disk0
#: type name size identifier
0: Apple_partition_scheme *74.5 GB disk0
1: Apple_partition_map 31.5 KB disk0s1
2: Apple_HFS odmasterHD 74.4 GB disk0s3
/dev/disk1
#: type name size identifier
0: Apple_partition_scheme *55.9 GB disk1
1: Apple_partition_map 31.5 KB disk1s1
2: Apple_HFS Archiv 55.8 GB disk1s3
/dev/disk2
#: type name size identifier
0: Apple_partition_scheme *111.8 GB disk2
1: Apple_partition_map 31.5 KB disk2s1
2: Apple_HFS LaCie120 111.7 GB disk2s3
In this example I got a small external disk called “Archiv” with important data on it, which I’d like to mirror to a second drive called LaCie120. This is just an example, because it doesn’t make much sense to create a mirror out of two drives with different sizes – you will loose the extended capacity of the second drive. So better you choose two drives of the same size.
Warning: promoting a single drive to be a degraded mirror can lead to data loss !! Backup up your data before you go ahead!
Now we’d like to tell Mac OS X that the Archiv volume should be part of a degraded mirrored RAID set.
‘Degraded’ means that the drive called ‘Archiv’ needs a second drive for the mirror, which we are adding in a following step.
We need the command line tool ‘diskutil’ to promote the ‘Archiv’ disk. To learn more about this tool, type
man diskutil
in your Terminal application.
To promote the disk, type
diskutil enableRAID mirror disk1s3
If you want to mirror the boot drive of a machine, you need to boot from a second Mac OS X system as diskutil can’t unmount the boot volume.
As you see above, you need to use your disk’s identifier in the command (which is displayed if you type ‘diskutil list’, like described above).
Instead of ‘mirror’ you can also choose ‘concat’, which means, that you can add a second drive to add capacity instead of security.
Terminal will then tell you something like
Changing filesystem size on disk 'disk1s3'...
Attempting to change filesystem size from 59877384192 to 59877359616 bytes
The filesystem may need to be modified to make this partition bootable
Found new RAID Master
Changing filesystem size on disk 'disk3'...
The disk has been converted into a RAID
If you open Disk Utility, now, it will display a new RAID set with a single drive:
Now we find out the RAID set’s identifier by typing:
diskutil list
/dev/disk0
#: type name size identifier
0: Apple_partition_scheme *74.5 GB disk0
1: Apple_partition_map 31.5 KB disk0s1
2: Apple_HFS odmasterHD 74.4 GB disk0s3
/dev/disk1
#: type name size identifier
0: Apple_partition_scheme *55.9 GB disk1
1: Apple_partition_map 31.5 KB disk1s1
2: Apple_Boot Boot OSX 128.0 MB disk1s2
3: Apple_RAID 55.8 GB disk1s3
/dev/disk2
#: type name size identifier
0: Apple_partition_scheme *111.8 GB disk2
1: Apple_partition_map 31.5 KB disk2s1
2: Apple_HFS LaCie120 111.7 GB disk2s3
/dev/disk3
#: type name size identifier
0: Apple_HFS Archiv *55.8 GB disk3
As you see, the new RAID set has the identifier ‘disk3′
The command to add the second drive to the RAID mirror is:
diskutil addToRAID member disk2s3 disk3
Instead of ‘member’ you can choose ‘spare’ which makes your drive a hot spare drive for your RAID set.
Your Terminal will answer something like this:
2007-03-30 10:47:14.494 DiskManagementTool[450] The target disk appears to be larger than the RAID set to which it is
being added. This will waste space on the target disk.
The disk has been added to the RAID
As you see, diskutil discovered that the second disk is bigger than the first one and warns me that I am wasting space.
Let’s see how it looks on the command line, now:
diskutil list
/dev/disk0
#: type name size identifier
0: Apple_partition_scheme *74.5 GB disk0
1: Apple_partition_map 31.5 KB disk0s1
2: Apple_HFS odmasterHD 74.4 GB disk0s3
/dev/disk1
#: type name size identifier
0: Apple_partition_scheme *55.9 GB disk1
1: Apple_partition_map 31.5 KB disk1s1
2: Apple_Boot Boot OSX 128.0 MB disk1s2
3: Apple_RAID 55.8 GB disk1s3
/dev/disk2
#: type name size identifier
0: Apple_partition_scheme *111.8 GB disk2
1: Apple_partition_map 31.5 KB disk2s1
2: Apple_Boot Boot OSX 128.0 MB disk2s2
3: Apple_RAID 111.7 GB disk2s3
/dev/disk3
#: type name size identifier
0: Apple_HFS Archiv *55.8 GB disk3
Now disk1s3 and disk2s3 are part of the RAID set Archiv with the identifier disk3.
This is how it looks in Disk Utility:
As you might see, Mac OS X automatically starts to copy data from the original disk to the fresh one.
After this is finished, you can tell Mac OS X to automatically rebuild a degraded RAID set in case one of the drives fails later on.
In Disk Utility it looks like this:
Activate ‘RAID Mirror AutoRebuild’ and click OK.
This is it!
Hope this information is a bit useful.




