Mdadm

From Briki
Revision as of 13:05, 19 April 2016 by Andrew (talk | contribs) (Created page with "== Overview == Several physical disks (/dev/sdX) or partitions (/dev/sdX1) of equal size are joined into a single array. == Creating a RAID array == * (Recommended) Create a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Several physical disks (/dev/sdX) or partitions (/dev/sdX1) of equal size are joined into a single array.

Creating a RAID array

  • (Recommended) Create a partition on each disk with the following attributes:
    • Use the "GPT" partition table format (to handle disks > 2TB)
    • Use optimal alignment for partition start (this will normally mean that the partition start will be at the 1MB boundary)
    • End 100MB before the end of the disk (this is to allow for slight variances in exact size of similar disks)
parted -a optimal -- /dev/sdX mklabel gpt mkpart 1 0MB -100MB
  • Create a RAID 5 array over 3 partitions:
    • Note, the default metadata version is now 1.2 for create commands
mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdX1 /dev/sdY1 /dev/sdZ1
  • Wait (potentially several days) for the array to be built
  • Once built, save the current raid setup to /etc, to allow for automounting on startup:
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
  • Start the array:
mdadm --assemble /dev/md0 /dev/sdX1 /dev/sdY1 /dev/sdZ1

Useful Commands

cat /proc/mdstat 
Display a summary of current raid status
mdadm --detail /dev/md0 
Display raid information on array md0
mdadm --examine /dev/sdf 
Display raid information on device/partition sdf