//   parse error

OS X : play with RAID

Two Mac Mini

Since the release of El Capitan in september 2015, Disk Utility.app has lost all features related to RAID. No more GUI if you want to build or repair a RAID set. Pretty annoying, isn't it ?

Well, Apple's strategy is pretty clear : hide what's unecessary to common people, but still give possibilities through the Terminal. Which is pretty cool, because I love the CLI. That's not really a good excuse and they could probably find a better way to expose power-user functions through the GUI, but at least it's consistent.

So, for this example, we're going to build a RAID 1 (mirroring) set with two external USB disks.

First, let's get a list of all available disks:

host:~ francois$ diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            499.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *4.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS G-DRIVE USB             4.0 TB     disk1s2
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *4.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS G-DRIVE USB             4.0 TB     disk2s2

Here we can see that we have 3 disks:

  • The first one is an internal hard disk drive of 500 GB called /dev/disk0,
  • The second one is an external hard disk drive of 4 TB called /dev/disk1,
  • And the third one is also an external hard disk drive of 4 TB called /dev/disk2.

It is very important to make sure you can identify the disks without any doubt ! Ok ? Let's ask diskutil to build a RAID 1 set with disk1 and disk2. The resulting volume should be formatted with a journaled HFS+ filesystem and be named backup:

host:~ francois$ sudo diskutil appleRAID create mirror backup JHFS+ disk1 disk2

Started RAID operation
Unmounting proposed new member disk1
Unmounting proposed new member disk2
Repartitioning disk1 so it can be in a RAID set
Unmounting disk
Creating the partition map
Using disk1s2 as a data slice
Repartitioning disk2 so it can be in a RAID set
Unmounting disk
Creating the partition map
Using disk2s2 as a data slice
Creating a RAID set
Bringing the RAID partitions online
Waiting for the new RAID to spin up "EE055FED-DDC8-4461-87E8-26CBBCBCC599"
Initialized /dev/rdisk3 as a 4 TB case-insensitive HFS Plus volume with a 311296k journal
Mounting disk
Finished RAID operation

Everything's allright. Right ? Let's check:

host:~ francois$ diskutil appleRAID list

AppleRAID sets (1 found)
===============================================================================
Name:                 backup
Unique ID:            EE055FED-DDC8-4461-87E8-26CBBCBCC599
Type:                 Mirror
Status:               Online
Size:                 4.0 TB (4000443039744 Bytes)
Rebuild:              manual
Device Node:          disk3
-------------------------------------------------------------------------------
#  DevNode   UUID                                  Status     Size
-------------------------------------------------------------------------------
0  disk1s2   1A1937AF-8B61-4A64-A2A8-C890C2B5E9B7  Online     4000443039744
1  disk2s2   96713456-F4FD-401D-B6B5-F518F977DEEA  Online     4000443039744
===============================================================================

We can see that we have a RAID set named backup, of type Mirror, built with two disks that are both Online. So yes, everything seems fine ! That was easy, wasn't it ?

diskutil also gave our RAID set a unique identifier (UUID) that will allow us to manipulate it. In our case, this UUID is EE055FED-DDC8-4461-87E8-26CBBCBCC599.

Still, the Rebuild option is set to manual, which means we'll have to manually rebuild the RAID set if a disk fails. Let's ask OS X to try to rebuild it automatically in case of a failure:

host:~ francois$ sudo diskutil appleRAID update AutoRebuild 1 EE055FED-DDC8-4461-87E8-26CBBCBCC599

Password:
The RAID has been successfully updated

host:~ francois$ diskutil appleRAID list

AppleRAID sets (1 found)
===============================================================================
Name:                 backup
Unique ID:            EE055FED-DDC8-4461-87E8-26CBBCBCC599
Type:                 Mirror
Status:               Online
Size:                 4.0 TB (4000443039744 Bytes)
Rebuild:              automatic
Device Node:          disk3
-------------------------------------------------------------------------------
#  DevNode   UUID                                  Status     Size
-------------------------------------------------------------------------------
0  disk1s2   1A1937AF-8B61-4A64-A2A8-C890C2B5E9B7  Online     4000443039744
1  disk2s2   96713456-F4FD-401D-B6B5-F518F977DEEA  Online     4000443039744
===============================================================================

Good !

So far, we only have 2 disks. In case of a failure, diskutil will try to re-use the failed drive to rebuild the RAID set. But if we had a third hard disk drive available, we could have asked OS X to use it as a spare drive:

host:~ francois$ sudo diskutil appleRAID add spare disk4 EE055FED-DDC8-4461-87E8-26CBBCBCC599

Started RAID operation on disk3 backup
Unmounting disk
Repartitioning disk4 for RAID
Adding disk4s2 to RAID Set
Finished RAID operation on disk3 backup

host:~ francois$ diskutil appleRAID list

AppleRAID sets (1 found)
===============================================================================
Name:                 backup
Unique ID:            EE055FED-DDC8-4461-87E8-26CBBCBCC599
Type:                 Mirror
Status:               Online
Size:                 4.0 TB (4000443039744 Bytes)
Rebuild:              automatic
Device Node:          disk3
-------------------------------------------------------------------------------
#  DevNode   UUID                                  Status     Size
-------------------------------------------------------------------------------
0  disk1s2   1A1937AF-8B61-4A64-A2A8-C890C2B5E9B7  Online     4000443039744
1  disk2s2   96713456-F4FD-401D-B6B5-F518F977DEEA  Online     4000443039744
-  disk4s2   B5069883-83D0-44F2-8D78-CCF3F1582595  Spare      4000443039744
===============================================================================

Note that adding a spare drive to a RAID set will also automatically set the Rebuild option to automatic.

← Billets de l'année 2015 - 2016