Creating a Complex RAID 10 with mdadm

Understanding the mdadm RAID10

In mdadm, the RAID10 level creates a single complex software RAID that combines features of both RAID 0 (striping) and RAID 1 (mirroring). Multiple copies of all data blocks are arranged on multiple drives following a striping discipline. Component devices should be the same size.

Comparison of RAID10 Option and Nested RAID 10 (1+0)

The complex RAID 10 is similar in purpose to a nested RAID 10 (1+0), but differs in the following ways:

Table 7.5. Complex vs. Nested RAID 10

Feature

mdadm RAID10 Option

Nested RAID 10 (1+0)

Number of devices

Allows an even or odd number of component devices

Requires an even number of component devices

Component devices

Managed as a single RAID device

Manage as a nested RAID device

Striping

Striping occurs in the near or far layout on component devices.

The far layout provides sequential read throughput that scales by number of drives, rather than number of RAID 1 pairs.

Striping occurs consecutively across component devices

Multiple copies of data

Two or more copies, up to the number of devices in the array

Copies on each mirrored segment

Hot spare devices

A single spare can service all component devices

Configure a spare for each underlying mirrored array, or configure a spare to serve a spare group that serves all mirrors.


Number of Replicas in the mdadm RAID10

When configuring a RAID10-level array, you must specify the number of replicas of each data block that are required. The default number of replicas is 2, but the value can be 2 to the number of devices in the array.

Number of Devices in the mdadm RAID10

You must use at least as many component devices as the number of replicas you specify. However, number of component devices in a RAID10-level array does not need to be a multiple of the number of replicas of each data block. The effective storage size is the number of devices divided by the number of replicas.

For example, if you specify 2 replicas for an array created with 5 component devices, a copy of each block is stored on two different devices. The effective storage size for one copy of all data is 5/2 or 2.5 times the size of a component device.

Near Layout

With the near layout, copies of a block of data are striped near each other on different component devices. That is, multiple copies of one data block are at similar offsets in different devices. Near is the default layout for RAID10. For example, if you use an odd number of component devices and two copies of data, some copies are perhaps one chunk further into the device.

The near layout for the mdadm RAID10 yields read and write performance similar to RAID 0 over half the number of drives.

Near layout with an even number of disks and two replicas:

sda1 sdb1 sdc1 sde1
0 0 1 1
2 2 3 3
4 4 5 5
6 6 7 7
8 8 9 9

Near layout with an odd number of disks and two replicas:

sda1 sdb1 sdc1 sde1 sdf1
0 0 1 1 2
2 3 3 4 4
5 5 6 6 7
7 8 8 9 9
10 10 11 11 12

Far Layout

The far layout stripes data over the early part of all drives, then stripes a second copy of the data over the later part of all drives, making sure that all copies of a block are on different drives. The second set of values start halfway through the component drives.

With a far layout, the read performance of the mdadm RAID10 is similar to a RAID 0 over the full number of drives, but write performance is substantially slower than a RAID 0 because there is more seeking of the drive heads. It is best used for read-intensive operations such as for read-only file servers.

Far layout with an even number of disks and two replicas:

sda1 sdb1 sdc1 sde1
0 1 2 3
3 5 6 7
. . .
3 1 2 3
7 4 5 6

Far layout with an odd number of disks and two replicas:

sda1 sdb1 sdc1 sde1 sdf1
0 1 2 3 4
5 6 7 8 9
. . .
4 0 1 2 3
9 5 6 7 8

Creating a RAID10 with mdadm

The RAID10-level option for mdadm creates a RAID 10 device without nesting. For information about the RAID10-level, see Section 7.3, “Creating a Complex RAID 10 with mdadm”.

The procedure in this section uses the device names shown in the following table. Make sure to modify the device names with the names of your own devices.

Table 7.6. Scenario for Creating a RAID 10 Using the mdadm RAID10 Option

Raw Devices

RAID10 (near or far striping scheme)

/dev/sdf1

/dev/sdg1

/dev/sdh1

/dev/sdi1

/dev/md3


  1. In YaST, create a 0xFD Linux RAID partition on the devices you want to use in the RAID, such as /dev/sdf1, /dev/sdg1, /dev/sdh1, and /dev/sdi1.

  2. Open a terminal console, then log in as the root user or equivalent.

  3. Create a RAID 10 command. At the command prompt, enter (all on the same line):

    mdadm --create /dev/md3 --run --level=10 --chunk=4 --raid-devices=4 /dev/sdf1 /dev/sdg1 /dev/sdh1 /dev/sdi1
    
  4. Create a Reiser file system on the RAID 10 device /dev/md3. At the command prompt, enter

    mkfs.reiserfs /dev/md3
    
  5. Edit the /etc/mdadm.conf file to add entries for the component devices and the RAID device /dev/md3. For example:

    DEVICE /dev/md3
    
  6. Edit the /etc/fstab file to add an entry for the RAID 10 device /dev/md3.

  7. Reboot the server.

    The RAID10 device is mounted to /raid10.


SUSE® Linux Enterprise Server Storage Administration Guide 10