Creating Raid in Debian
# apt-get update mdadm
Partition HDD
# fdisk /dev/sdb
To list exiting partition , p
if have partition, delete al, To delete existing partition , d
Create new partition , n
and create all as primary partition
after done set partition type, t
and then at prompt set as raid, fd
Then, save the partition table and exit, w
then “fdisk -l /dev/sdb” , shld see “Linux raid autodetect” at /dev/sdb1
Do the same at /dev/sdc
Create Raid
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
To see raid progress
# watch -n cat /proc/mdstat
Shld see raid is building
Sync Raid faster
echo 500000 > /proc/sys/dev/raid/speed_limit_min
echo 500000 > /proc/sys/dev/raid/speed_limit_max
Or any value
Or using following command
sysctl -w dev.raid.speed_limit_min=500000
sysctl -w dev.raid.speed_limit_max=500000
To create filesystem to the raid drive
# mkfs.ext3 /dev/md0
Mount the Raid Drive
# mkdir /vmdisk
# mount /dev/md0 /vmdisk/
# df -H /vmstore/
Testing Raid Speed
Try to write something and delete it
# cd /vmdisk
# dd if=/dev/zero of=output bs=8k count=256k
# rm output
Permernently Mount Raid and mount when system boot
Edit /etc/fstab , add following line at the bottom
/dev/md0 /vmdisk ext3 noatime,rw 0 0
Checking Raid Information
# mdadm --query --detail /dev/md0