http://wiki.centos.org/HowTos/SoftwareRAIDonCentOS5
http://wiki.xtronics.com/index.php/Raid
http://robbat2.livejournal.com/231207.html
https://raid.wiki.kernel.org/index.php/Linux_Raid
http://archive.networknewz.com/2003/0113.html
Works on block devices, usually partitions. This is not like strictly-drive-oriented hardware RAID controllers.
mdadm --detail --scan --verbose
fdisk -l /dev/sda
or
sgdisk -p /dev/sda
Copy Patition Scheme: https://askubuntu.com/questions/57908/how-can-i-quickly-copy-a-gpt-partition-scheme-from-one-hard-drive-to-another/333923
Verify sfdisk
recognizes your source partitions. If not, try sgdisk
.
Using fdisk, create matching partitions on various drives (block devices) of type fd Linux raid autodetect that will be assembled into arrays.
sfdisk -l /dev/sda Disk /dev/sda: 8942 cylinders, 255 heads, 63 sectors/track Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0 Device Boot Start End #cyls #blocks Id System /dev/sda1 * 0+ 242 243- 1951866 fd Linux raid autodetect /dev/sda2 243 485 243 1951897+ fd Linux raid autodetect /dev/sda3 486 607 122 979965 82 Linux swap
Be careful not to write to the wrong disk or you will have a very bad day!
Once you partition the first drive, use sfdisk
or sgdisk
to replicate partitions from that first drive to other drives:
sfdisk -d /dev/sda | sfdisk /dev/sdb
or
sgdisk /dev/sda -R /dev/sdb sgdisk -G /dev/sdb
http://robbat2.livejournal.com/231207.html
http://en.wikipedia.org/wiki/Mdadm
mdadm --create <[[array]]_device> -c <chunk_size> -l <raid_level> -n <active_disks> -x <spare_disks> <block_devices>
Here is a four-drive (partition) RAID5 example where one drive (partition) is a hot spare. Hot spare drives can serve multiple arrays (spare-group).
mdadm --create /dev/md0 --level=5 --raid-devices=3 --spare-devices=1 --spare-group=groupname /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
http://www.kernelhardware.org/linux-add-share-hot-spare-device-software-raid/
mdadm --detail --scan --verbose mdadm --add /dev/md0 /dev/sdb1 mdadm --add /dev/md1 /dev/sdb2 mdadm --add /dev/md2 /dev/sdb3
Not sure how beneficial or necessary this step is…
mdadm --detail --scan > /etc/mdadm/mdadm.conf
or for Centos:
mdadm --detail --scan --verbose > /etc/mdadm.conf
http://www.cyberciti.biz/faq/howto-copy-mbr/
Assuming you have identical disks with identical partitioning, use this command to copy the entire master boot record (boot code plus partition table) like this, adjusting for your needs:
dd if=/dev/sda of=/dev/sdb bs=512 count=1
http://wiki.centos.org/HowTos/GrubInstallation
grub
If you have a separate /boot partition:
grub> find /grub/stage1
If you don't:
grub> find /boot/grub/stage1
Then, based on the output of the find command:
grub> root (hd0,0) grub> setup (hd2)