Base Install of Debian Sarge with RAID

From Wiki

Jump to: navigation, search

Contents

RAID 1 and mdadm

This is a "How to" setup for RAID 1 on Linux. It is applied to Debian sarge, however through the use of mdadm (multiple devices admin) it should be able to work on various Linux installs.


RAID 1 setup with a NEW install of Debian Sarge

Two hard disks of 2gb in total each were setup with RAID. This is done through some careful looking in the Debian Install process.

  • Make sure also to Choose - linux26 when booting the Debian Install CD
  • Follow the install procedure for Creating Partitions VERY carefully.
  • The key point is - when creating a volume, do not choose ext3 -> choose "RAID Volume" for Both hard disks.
  • From the install process it is possible to get the RAID 1 array working perfectly. Note: LVM is NOT used.


General Information on Managing RAID

mdadm is the tool used to control and manage the RAID array.

mdadm -D /dev/md0   //Show the details of the md0 array
mdadm -E /dev/sda1 //Examine the Hard Disk sda1
cat /proc/mdstat    //Shows the RAID array. [UU]=2 disks are fine. [_U]=1 disk needsss rebuilding
mdadm --examine --scan //Shows the disks and their array. This information should be in the config file /etc/mdadm/mdadm.conf


Monitoring a RAID Array

ps -eaf  //It should show the Monitor already! - /sbin/mdadm -F -i /var/run/mdadm.pid -m root -f -s
//To monitor manually ->
mdadm --monitor --mail=root --delay=300 /dev/md0
nohup mdadm --monitor --mail=sysadmin --delay=300 /dev/md0 &  //The & will background the monitoring


Prepare BOTH Hard Disks so EITHER one will boot via Grub

This MUST also be DONE after REBUILDING an ARRAY!!!
The MBR has to be reinstalled after having replaced the broken disk:

//For Disk 1
grub 
device (hd0) /dev/sda 
root (hd0,0) 
setup (hd0) 

//For Disk 2
grub 
device (hd1) /dev/sdb 
root (hd1,0) 
setup (hd1) 

How to Rebuild an Array:

mdadm --add /dev/md0 /dev/sda1
mdadm --add /dev/md0 /dev/sdb1
//chose which ever one is necessary
//MAKE SURE TO DO THE GRUB BOOT LOADER - OTHERWISE PC WONT BOOT!!!!!!!!!!!

Further Information can be found at:
http://www.networknewz.com/2003/0113.html
http://www.linuxmanpages.com/man8/mdadm.8.php
http://www.planamente.ch/emidio/pages/linux_howto_root_lvm_raid.php#Creating%20RAID%20devices //Excellent

Personal tools