2009-05-05

LINUX RAID

1. Disk partioning:
fdisk /dev/sda
n - create new partition
t - create partition with type RAID (fd - Linux raid autodetect)

2. Create array:
mdadm --create /dev/md[nr] --level=[0|1|etc] --raid-devices=2 /dev/sda1 /dev/sdb1
3. Format array:
mkfs.ext3 /dev/md[nr]
4. Create directory
5. Mount array
6. Add to /etc/fstab
echo "/dev/md[nr] /[katalog] defaults 0 2" >>etc/fstab
7. Create file /etc/mdadm.conf
echo "DEVICE /dev/sda1 /dev/sdb1" > /etc/mdadm.conf
mdadm --detail --scan >> /etc/mdadm.conf

General:
mdadm --add /dev/md[nr] /dev/sda2 #add disk to synchronize with array
mdadm -E /dev/sda1 #info about device inside array
cat /proc/mdstat #present state of array
mdadm --stop /dev/md[nr] #stop array, free devices
mdadm --assemble #mount arrary
mdadm --detail --scan #info about components from /proc/mdstat