Kabads

How to set-up RAID on Linux

RAID disks offer particular advantages over ordinary single disk set up. Data redundancy is improved (consider it to be a continuous backup) and also significant performance can be seen with the correct configuration.

There are different types of RAID levels and each level will need to be chosen on a use-case:

Firstly, you should have at least two partitions that have been set to the file type ‘fd’, using fdisk.

The command that helps us manage RAID drives is mdadm - ensure that it is intalled - the following command will do this on Ubuntu.

$ sudo apt-get install mdadm

Then, set-up the array with the following command:

$ sudo mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdbX /dev/sdcX

You will need to change the level according to the RAID level that you chose from above, and the number of disks, if this is different from 2. Now is the time to create the filesystem:

$ sudo mkfs.ext3 /dev/md0

Obviously, you can choose the filesystem according to your taste.

Next, /etc/mdadm.conf needs changing, which can be done with the following command:

$ sudo bash -c "mdadm --detail --scan >> /etc/mdadm.conf"

Create a mount point:

$ sudo mkdir /myraid

Then mount the drive to the point:

$ sudo mount /dev/md0 /myraid

That will provide a drive with root permissions, which will need change if you require other users to use this drive.