Robert Harker Technical Wiki
Thoughts and Ideas About Large Sites

[ Prev ] [ Index ] [ Next ]


Software RAID

TOPIC

Linux Create Software RAID 1 (Mirror) Array
http://www.cyberciti.biz/faq/linux-creating-software-raid-one-arrays/
run fdisk on /dev/sdb and /dev/sdc with "Software Raid" type i.e. type 0xfd:
# fdisk /dev/sdb
# fdisk /dev/sdc
If the device contains a valid md superblock, the block is overwritten with zeros:

# mdadm --zero-superblock /dev/sdb /dev/sdc
Create RAID1 using /dev/sdb1 and /dev/sdc1

# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
Format /dev/md0 as ext3:

# mkfs.ext3 /dev/md0

Edit /etc/fstab

Make sure RAID1 get mounted automatically. Edit /etc/fstab and append the following line:

/dev/md0 /raid1 ext3 noatime,rw 0 0

How Do I See RAID Array Building Progress and Current Status?
atch -n 2 cat /proc/mdstat
OR
# tail -f /proc/mdstat
Update /etc/mdadm.conf File
ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1 level=1 num-devices=2 auto=yes

This config file lists which devices may be scanned to see if they contain MD super block, and gives identifying information (e.g. UUID) about known MD arrays. Please note that Linux kernel v2.6.xx above can use both /dev/mdX or /dev/md/XX names. You can also create partitions for /dev/md/XX as /dev/md/d1/p2.
How Do I Get Information On Existing Array?

Type the following command
# mdadm --query /dev/md0

mdadm --zero-superblock --force /dev/sdb /dev/sdc
# You will see the error message:
# mdadm: Unrecognised md component device - /dev/sdb1
# If the disk previously had software raid partitions
#
lsmod | grep md
cat /proc/mdstat
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
mkfs.ext3 /dev/md0
vi /etc/fstab
mount /dev/md0 /mnt


Backlinks: index Start
Created with Zim desktop wiki