Get a list of available hard drive
ls -lh /dev/sd* or ls -lh /dev/hd*
Example Output:
[root@sKy-Centos ~]# ls -lh /dev/sd*
brw-rw----. 1 root disk 8, 0 Jun 13 22:53 /dev/sda
brw-rw----. 1 root disk 8, 1 Jun 13 22:53 /dev/sda1
brw-rw----. 1 root disk 8, 2 Jun 13 22:53 /dev/sda2
brw-rw----. 1 root disk 8, 16 Jun 13 22:53 /dev/sdb
brw-rw----. 1 root disk 8, 17 Jun 13 22:55 /dev/sdb1
brw-rw----. 1 root disk 8, 32 Jun 13 22:53 /dev/sdc
brw-rw----. 1 root disk 8, 33 Jun 13 22:55 /dev/sdc1
[root@sKy-Centos ~]#
Suppose we want to create RAID 0 from /dev/sdb and /dev/sdc and delete all partition inside (fresh RAID installation).
fdisk /dev/sdb
On fdisk interface, use “p” to print partition table to screen, “d” to delete partition, “n” to create new partition, and “w” to write changes to disk. Do the same thing to /dev/sdc
Next, we need to create RAID partition, in this example, we use /dev/md0 as a new name for RAID partition
mdadm -C /dev/md0 --level=raid0 --raid-devices=2 /dev/sdb1 /dev/sdc1
If the system complaints about cannot continue because device is busy, try to reboot and run the command again or check if RAID is already running with this command
cat /proc/mdstat
Example Output:
[root@sKy-Centos ~]# cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sdc1[1] sdb1[0]
10471424 blocks super 1.2 512k chunks
unused devices:
and stop it with
mdadm --stop /dev/md0
Create mount point for our new RAID 0 Partition, for example, we will use /widi as mount point.
mkdir /widi
Edit /etc/fstab and add that partition
/dev/md0 /widi /ext3 defaults 1 1
Format /dev/md0 before actual mounting
mkfs.ext3 /dev/md0
Finally, mount /widi
mount /widi
Some notes on mdadm. It is not necessary to had the same size for the RAID 0. mdadm will adjust so extra space on larger drive won’t be used for stripping.
