What is RAID? Well, it basically gives you the power to do some funky stuff with multiple hard drives. It lets you combine hard drives, split data amongst several hard drives, and do other things. It can increase the speed to write and read your data to your hard drives and it can make backup copies of your hard drives so that if one hard drive crashes, you can most likely retrieve all your data. Read more about the RAID Levels from The Software-RAID HOWTO right now to get a better idea about the different types of Software RAID.
Also, you will need to setup several small partitions for this example. I suggest having 1 gig of diskspace free for an extended partition, and then to make 100 meg logical partitions out of the extended partition. Also, PLEASE PLEASE PLEASE only test raiding on a hard drive you don't care about. If you screw it up, it is your fault, even if my documentation is incorrect.
There are basically 4 steps to setup a Strip RAID on your Linux system. striping puts data on two or more hard drives (actually partitions) where half the data is on one hard drive and the other half on the other. This increases your speed since you use BOTH the hard drives at the same time to get each half of the data. Again, please read more about this in the HOWTO.
First, we need to configure /dev/md0, then we need to initialize the partitions, and then we need to configure /etc/rc.d/rc.local to activate the raid, and then we need to configure /etc/rc.d/rc.local to mount the stripped device to a directory.
The Steps Well, I am going to do a trick. Instead of actually using two hard drives, I am going to assume that most of the low-end users don't have two hard drives. Hence, I will use two partitions on the same hard drive. Make an extended partition with two logical partitions, /dev/hda5 and /dev/hda6, which should be the same size. striping two partitions on the same hard drive is almost pointless, and even on the same IDE controller it is almost pointless. Still, this is just an EXERCISE.
raiddev /dev/md0 raid-level 0 nr-raid-disks 2 nr-spare-disks 0 chunk-size 4 persistent-superblock 1 device /dev/hda5 raid-disk 0 device /dev/hda6 raid-disk 1
mkraid /dev/md0If you have problems with using the "mkraid" command, it will tell you how to get around any problems. Then issue this command
mkfs -t ext2 /dev/md0Also, check out the status of your raid by looking at the "/proc/mdstat" file/.
cat /proc/mdstat
echo "raidstart /dev/md0" >> /etc/rc.d/rc.local
mkdir /RAID echo "mount /dev/md0 /RAID" >> /etc/rc.d/rc.local
raidstart /dev/md0 mount /dev/md0 /RAIDAlso, check out the status of the mounted directory by issuing the single command
df
First, we need to configure /dev/md0, then we need to initialize the partitions, and then we need to configure /etc/rc.d/rc.local to activate the raid, and then we need to configure /etc/rc.d/rc.local to mount the mirrored device to a directory.
raiddev /dev/md0 raid-level 1 nr-raid-disks 2 nr-spare-disks 0 chunk-size 4 persistent-superblock 1 device /dev/hda5 raid-disk 0 device /dev/hda6 raid-disk 1
mkraid /dev/md0If you have problems with using the "mkraid" command, it will tell you how to get around any problems. Then issue this command
mkfs -t ext2 /dev/md0Also, check out the status of your raid by looking at the "/proc/mdstat" file/.
cat /proc/mdstat
echo "raidstart /dev/md0" >> /etc/rc.d/rc.local
mkdir /RAID echo "mount /dev/md0 /RAID" >> /etc/rc.d/rc.local
raidstart /dev/md0 mount /dev/md0 /RAIDAlso, check out the status of the mounted directory by issuing the single command
df
Use the same steps for the Mirror or Strip, just change the config file to this.
raiddev /dev/md0 raid-level 5 nr-raid-disks 7 nr-spare-disks 1 persistent-superblock 1 parity-algorithm left-symmetric chunk-size 32 device /dev/hda5 raid-disk 0 device /dev/hda6 raid-disk 1 device /dev/hda7 raid-disk 2 device /dev/hda8 raid-disk 3 device /dev/hda9 raid-disk 4 device /dev/hda10 raid-disk 5 device /dev/hda11 raid-disk 6 ### Also, let us have a spare device device /dev/hda12 spare-disk 0
Well, it is pretty freaking cool. The documentation used to really suck rocks, but that howto has been updated, the tools seem easier to use, and with these few examples, and amateur who knows how to use Linux can probably setup a raid device. Hopefully this will reduce the overall cost of RAID servers.
If you really want to do Software raiding correctly, get an U2W SCSI controller, like an Adaptec controller or other good brands, DPT, Mylex, etc. For cheap raids where you are just mirroring and don't care about speed, IDE hard drives are okay. If you want to go one step beyond software raid and to get into hardware raid, then several companies support hardware raid for Linux.