Raid

From Tim's Wiki
Jump to: navigation, search

Complete info: http://gentoo-wiki.com/HOWTO_Gentoo_Install_on_Software_RAID

Partitions

Clone partitions (only for identical hard drives):

sfdisk -d /dev/sda | sfdisk /dev/sdb

When you partition your disks, make sure that your partitions use fd (Linux raid autodetect) as Partition Type instead of the default 83 (Linux native) or 82 (swap).

Create array

mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --detail --scan >> /etc/mdadm.conf

Copy all hard drive files:

find /mnt/orig-disk -depth -print0 | cpio -pmdv --null /mnt/other-disk

Source

Install Grub

grub>
device (hd0) /dev/sda
root (hd0,0)
setup (hd0)
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)

Management

Check:

echo check >> /sys/block/mdX/md/sync_action

Repair:

echo repair >> /sys/block/mdX/md/sync_action

Status:

cat /proc/mdstat

Make sure notification is working:

mdadm -Fs1t

Drive Serial Number

sdparm -i /dev/sda

Add Drive

Install drive.

mdadm --manage --add /dev/mdX /dev/sdXX
mdadm --grow --raid-disks=N /dev/mdX

Wait until finished

cryptsetup luksOpen /dev/mdX <data>
cryptsetup resize <data>
e2fsck -f /dev/mapper/<data>
resize2fs -p /dev/mapper/<data>