Software RAID in Windows, macOS, and Linux

Solid Foundation

Software RAID in macOS

The option of merging hard disks to form RAID groups is also available in macOS: RAID0 for better performance, RAID1 for higher availability, and JBOD (just a bunch of disks) for concatenating smaller drives. The File | RAID Assistant menu in Disk Utility (Figure 3) lets you select which RAID system you want to configure. As mentioned, you have three options from which to choose:

Figure 3: macOS can handle three different RAID configurations.
  • Striped (RAID 0) : The selected hard drives are combined to create a single disk in RAID0. Write operations take place on both hard disks, which increases the speed of hard disk accesses, especially write access. If one of the drives fails, most likely all of the data is gone, including the data stored on the other drive.
  • Mirrored (RAID 1) : The data is written to all participating hard disks simultaneously during operation, which increases the safety and availability of the data.
  • Concatenated (JBOD) : In general, creating a JBOD disk consists of adding all the disks involved into a RAID0 setup. However, writes do not take place in parallel; instead, the storage space is combined to create a common data carrier. JBOD is therefore an alternative to RAID0.

After selecting the hard drives you want to include in the new RAID array, name and choose the filesystem to be used. You also need to specify the Chunk size . If you enable the Automatically rebuild (RAID1) option, the RAID drive can repair itself if a disk fails and you install a new disk to the system. You can also recover manually when reconnecting a hard disk in Disk Utility.

The RAID system is available as a traditional drive in the Finder. If you click on the RAID system in Disk Utility, information about the disk appears on the right side in the application window. At the top is listed the free and occupied storage space, with the total capacity and hard drives involved, and the status of the RAID and disk. The Status should always be Online ; anything else means a hard drive has failed. You can add additional disks by pressing the plus button under the RAID set window.

If a hard disk in the macOS RAID fails and you install a new drive, you can start a recovery process by pressing the Restore button at the top. You also need to follow this procedure if you remove a disk from the computer that was part of a RAID setup.

Linux RAID Choices

In Linux, RAID is often referred to as MDRAID or MD/RAID. The implementation of software RAID is mostly handled by the mdadm driver, which is available in many Linux distributions. Linux supports more software RAID configurations than Windows or macOS:

  • RAID0: In Linux, too, you have the option of creating software RAID by combining at least two physical disks to create a logical shared disk.
  • RAID1: Hard drive mirroring with at least two disks.
  • RAID4: Like RAID5, but the parity data is stored on a separate hard drive. At least four disks are required. RAID4 can compensate for the loss of a disk.
  • RAID5: Three hard disks are required. In contrast to RAID4, the parity data is distributed across the disks. RAID5 can compensate for the loss of a disk.
  • RAID6: At least six hard disks are required. RAID6 can compensate for the loss of two disks.
  • RAID10: At least four hard disks are required. RAID10 combines the speed advantages of RAID0 with the data mirroring of RAID1.

Which RAID system you use depends mostly on the number of hard disks available on the system.

Preparations for Linux RAID

If mdadm is not available on your Linux system, install the driver with:

sudo apt install mdadm

The mdadm --help command takes you to the help feature for the command (Figure 4). To create a RAID1 system in Ubuntu, use the command:

sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb
Figure 4: The mdadm command lets you create software RAID on Linux systems.

When you are installing Linux RAID, you need to make a note of drive serial numbers. If a drive fails, it is easier to recover if the serial number can be used to identify exactly which drive failed. To do this, install the Smartmontools and use either of two the commands that follow:

apt-get install smartmontools
hdparm -i /dev/sd<Drive> | grep Serial
smartctl -i /dev/sd<Drive>

Before setting up a RAID system on Linux, you need to create a new partition table with the general command:

parted /dev/sd<Drive> mklabel gpt

For example, to create a partition on 100 percent of the disk space of a drive, use the command:

parted -a optimal -- /dev/sd<Drive> mkpart primary 2048s 100%

You can configure a partition as RAID-capable with:

parted /dev/sd<Drive> set 1 raid on

A RAID6 system is created with:

mdadm --create /dev/md0 --level=6 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde

Next, save the RAID configuration by creating a configuration file:

mdadm --examine --scan --verbose > /etc/mdadm/mdadm.conf

You can format a RAID5 system with the ext4 filesystem, for example, with the command:

mkfs.ext4 -v -m 1 -b 4096 -E stride=128,stripe-width=256 /dev/md0

To mount the RAID, enter:

mkdir /mnt/raid
mount /dev/md0 /mnt/raid

Finally, to mount the RAID automatically when you boot your Linux computer, add the line

/dev/md0 /mnt/raid ext4 defaults 0 0

to the /etc/fstab file.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs

Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>


		<div class=