-
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.
Show details:# mdadm --detail /dev/md0
# mdadm --manage /dev/md0 -f /dev/hda8
Note: When partition is marked faulty, the spare quickly replaces it in RAID 1 array.
Remove:# mdadm --manage /dev/md0 -r /dev/hda8
Note: Only faulty partitions can be removed.
Add:# mdadm --manage /dev/md0 -a /dev/hda8
Note: Only removed partitions can be added.
Stop RAID:# mdadm --stop /dev/md0
# 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}
# mdadm --zero-superblock /dev/hda{8,9,10}
# mdadm --examine --scan
mdadm --detail --scan
# nohup mdadm --monitor --mail=root --delay=300 /dev/md0 &
Related Links:
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
Redhat software RAID with MD devices
Redhat software RAID with MD devices