RAID notes...

  1. Create RAID-1 level array with 2 active devices and 1 spare:
    # mdadm -C /dev/md0 -l 1 -n 2 /dev/hda{8,9} -x 1 /dev/hda10

    Note: RAID-1 provides for redundancy and needs a minimum of 2 partitions and any number of spares.

  2. Show details:
    # mdadm --detail /dev/md0
  3. Mark Faulty:
    # mdadm --manage /dev/md0 -f /dev/hda8

    Note: When partition is marked faulty, the spare quickly replaces it in RAID 1 array.

  4. Remove:
    # mdadm --manage /dev/md0 -r /dev/hda8

    Note: Only faulty partitions can be removed.

  5. Add:
    # mdadm --manage /dev/md0 -a /dev/hda8

    Note: Only removed partitions can be added.

  6. Stop RAID:
    # mdadm --stop /dev/md0
  7. Run RAID:
    # mdadm --assemble /dev/md0 /dev/hda{8,9,10}

    Note: Before assembling, check on the UUID of the devices. They should all be the same and show only one array:

    mdadm --examine --scan /dev/hda{8,9,10}

  8. Remove the md signature from disk
    # mdadm --zero-superblock /dev/hda{8,9,10}
  9. Scan md superblock
    # mdadm --examine --scan
  10. Scan currently active arrays
    mdadm --detail --scan
  11. Monitor RAID:
    # nohup mdadm --monitor --mail=root --delay=300 /dev/md0 &

Related Links:

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
activating logical volumes

Often times, I use lvm over raid and need to activate the logical volumes during a rescue for running fsck after activating raid. Below are the commands to automate the process of activating the logical volumes:

vgscan
vgchange -a y [VolumeGroup]

You can then scan the volumes via:

lvscan

auto assemble raid

mdadm --assemble --scan

or

mdadm --auto-detect

Comment