This article describes step by step setup of Linux software RAID 1 on Linux Platform. Although this software RAID 1 configuration has been accomplished on Debian ( Ubuntu ) it also can guide you if you are running some other Linux distributions such as RedHat, Fedora , Suse, PCLinux0S etc. For RAID-1 setup we need two or more disks. RAID1 mode creates a exact mirror of all data between two or more disks.
1.1. System Info
- OS: Debian Etch ( basic installation on /dev/sda)
- Kernel: Linux raid 2.6.18-5-686 #1 SMP Fri Jun 1 00:47:00 UTC 2007 i686 GNU/Linux
- Hard Drives: /dev/sda -> 4GB , /dev/sdb -> 5GB
2. The Plan
We start with running linux system Debian Etch and the following partition scheme and hard drives ( sda , sdb ):
3. Software Installation
There is only 1 package ( + prerequisites ) needed by software raid 1 on debian. This package is mdadm. Simply use apt-get tool to install mdadm package it into your system. You may be asked to answer couple question.
apt-get install mdadm
4. Configure Kernel Modules
4.1. Load modules at boot time
No we need to make sure that raid kernel modules are loaded at the boot time. To accomplish this task we need to edit /etc/modules files and add couple lines. Open up your favorite text editor or just simply append lines with echo command.
echo raid1 >> /etc/modules echo md >> /etc/modules
4.2. Load modules to the Kernel
At this stage if we want to use raid modules we have two options. First one is to reboot our system and the other option is to use modprobe or insmode to load modules to the Kernel. I find second option easier:
modprobe raid1
NOTE: if you do not have md module already loaded as shown on the figure above use modprobe to load it:
modprobe md
There are two ways to confirm that our raid modules are loaded into kernel:
lsmod | grep raid1
cat /proc/mdstat
You should have similar output as shown on the figure below:
No comments:
Post a Comment