Child pages
  • Multiple devices (md, software RAID)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

md was originally "mirror disk".  It was renamed "multiple devices" when functionality was extended to more than mirrored disks.  Functionality now includes non-mirrored RAID and multipathing.  At the time of writing, Blue Light had only used md to create RAID 1 devices.

md assembles multiple devices into a single virtual device.

The multiple devices are variously called "underlying devices" and "RAID devices" in the documentation.  On this WIKI page they are always "underlying devices".

At the time of writing, Blue Light has:

...

md device file names

Originally md device files were /dev/md[[:digit:]]

...

TODO: better we move with the times and start using +.  Now /dev/md/* device names as the installer does?[[:digit:]]+ is preferred.

RAID 1

Creation

Create the block devices to be used as underlying devices.  Typically these are HDD partitions but any block devices can be used.  In the following example, /dev/sdb1 /dev/sdc1 are used.

...

Typically this is done when an HDD has failed.

DOS partition table (a.k.a MBR)

In case the replacement HDD is the same size and has the same partitions as a working HDD, the partitions can be created and GRUB installed in a single command.  Assuming sda is the working HDD, partitioned with an MBR and sdb the replacement:

Code Block
dd if=/dev/sda of=/dev/sdb bs=512 count=1

...

The procedure continues at "All partition table types" below.

GUID partition table (GPT)

Create the new underlying device must be created as appropriateby partitioning.

All partition table types

Regardless of how the underlying block device was created, it can now be added to the md device.  Assuming the underlying device is sdb1 and the md device is md0:

mdadm --manage --add /dev/md/<md device index> /dev/<whatever>

For example:

mdadm --manage --add /dev/md/md0 0 /dev/sdb1

 

Remove an md device

Removing /dev/md1 as an example ...

...

Finally remove the device:

mdadm --remove /dev/md1

Booting from an md RAID 1 device

TODO: confirm and clarify this section.

Assuming When a RAID 1 md device is being used for /boot, the only mechanism available before GRUB2 was for the boot loader to load initrd (or the kernel directly) from one of the underlying block devices in the normal way and then assemble the /boot md.GRUB should be installed to both underlying devices, not to the md device.  This is done using

dpkg-reconfigure pc-grub

GRUB2 can be configured to include md support so can assemble the /boot md before loading initrd (or the kernel directly) but Blue Light does not do this.

Start all md devices

Some linux system integrated an mdadm tool called mdadm-startall. You can install it if not already done.

...