Monday, April 14, 2014

Configuring RAID 1 on MAC OSx Server


Jul 30, 2011 3:00 AM (in response to ideelist)
I found the basic principle on another forum thanks to a guy called 'e-whizz' and this what I did to make RAID 1 work on a mac mini server with LION server.

You can easily configure the second drive on a mac mini server for a Mirrored RAID 1 set with Lion Server without either reinstalling or erasing your existing setup.
The initial setup process takes about 30 minutes, though the rebuilding of the mirror disk will take several hours, depending on the amount of data you have on the drive. It took around 3 hours on a new mac mini server with lion server installed, nothing else configured.

Before you start, please ensure you have a current backup of the server. Getting the following commands wrong can render you server unusable.

What you need to use is the command line version of Disk Utility, diskutil.

Before you start, clone the hard drive. You can use SuperDuper (or similar, I have used SuperDuper) with copying all files onto a USB memory stick. If Lion is freshly installed, 8Gb will do. SuperDuper will create a bootable copy on the USB.

Boot the mac mini from the external USB. To do that, reboot and hold down the option key while restarting. You will see a window, select the USB drive to boot from.

Launch the terminal and type the following command:
diskutil list

This gives you a list of all the drives and partitions your system knows about.
You need to find the Server HD partition (the first disk) and the HD2 partitions (the second disk). These are the two main ~500GB drives. You will be using the disk IDENTIFIERs when issuing the diskutil commands. For a stock standard Mac Mini Server, the commands below are correct, but if you have previously changed the volume names, or repartitioned at any stage the disk identifiers and volume names may differ.

First enable RAID mirroring on existing Server HD volume. This will create a single disk, unpaired mirror, without affecting your data.

Using this syntax:
diskutil appleRAID enable mirror disktomirror
where disktomirror is your disk identifier for Server HD

On my mac mini server, Server HD was disk0s2, so I used this command:
diskutil appleRAID enable mirror disk0s2

You now need to run diskutil list again to see the disk identifier for the new RAID volume. The new RAID volume will be listed as disk# on its own at the bottom of the list.
On my mac mini server this was disk3 (disk 2 was the USB I booted from, disk 0 the first disk and disk 1 the second disk)

Next add the disk HD2 to the Server HD raid mirror volume (on my mac, as I said before, this is disk3) as a new member.

This step will erase disk HD2 and begin an auto repair of the Server HD.

Using this syntax:
diskutil appleRAID add member newdisk raidvolume
replacing newdisk and raidvolume with your particular disk identifiers

On my server this was:
diskutil appleRAID add member disk1s2 disk3


To follow the progress of rebuilding the mirror set, type
diskutil list
It will show you the progress in % of the rebuilding under status

Once finished, reboot and your RAID 1 is up and running and you have also a working backup on your USB (coz' that's where you booted from ;-)

After reboot you can check the status of your RAID with
diskutil appleRAID list
Both drives should show ONLINE under status, interestingly, the device node for the RAID changed on my mac mini server from disk3 to disk2


That's it

No comments:

Post a Comment