Engr. F. Azam

An Internet Professional – Dedicated for SEO and Open Source Community

Archive for the ‘Disk Mirrorring’ Category

To do Disk Mirrorring With Software Raid In Debian

Posted by Rock on September 3, 2007

To do Disk Mirrorring With Software Raid In Debian follow the following
steps

1. Normal boot at start up with the boot disk
2. Manual Network configuration
3. Create the  Partition as follows
We use 41 GB > 40 GB as /
1 GB as swap
In first HDD>> ***follow the partition sequence strictly

/ as RAID and Add boot able flag with this partition (most important)
Rest of it swap format it as swap

In Second HDD>> ***follow the partition sequence strictly
As same as the first one and mantain the partition sequence

4. Configure Software RAID > give it ‘yes’
5. Then Create MD Device
6. select RAID 1
7. number of active device for the RAID1 array: give here the value 2
8. Number of spare devices for the RAID1 array: give here the value 0

9. Now select the active RAID devices to create array >
Select the two partition with * and then >continue>finish

10. Now it shows up a new RAID1 device with 40 GB space along with the
two HDD as IDE1 and IDE2
> Format it with ext3 file system and mount as / (The RAID1 device not
the others leave others untouchable)

11 . After completion > Finish partitioning and write changes to disk
12 . Write changes to disk > Yes
13 . Load GRUB on MBR > Yes
14. Now complete as usual

After the completion the installation login as root user and then follow
the procedures >

1 .run the command

#cat /proc/mdstat

it will show the syncing process of two devices.run this periodically to
see when the process finish. before finishing don’t reboot or shutdown
the pc that will cause errors.

After finishing the process run these commands
#grub
#root (hd1,0)
#setup (hd1)
#quit

it will setup the GRUB boot image on second HDD
Now Reboot the PC.

After rebooting do some changes with files and packages then shutdown
the PC.
Now for testing Boot up the PC with unplugging the master HDD
If the PC reboot and run normally and all previously made changes will
remain up to date then all is ok

Now this is the time to Bring the first HDD up

1. Reboot the system with Plug in the Primary HDD.

2. Now erase all partitions on primary harddisk drive and do partition
again  40 GB as /  & 1 GB as swap, make / Bootable
You can make this by using fdisk or cfdisk utilities.

3 .Now Run these commands to add this device as mirror
#mdadm /dev/md0 -f /dev/hda1
#mdadm /dev/md0 -a /dev/hda1
#cat /proc/mdstat         to see the syncing process. Run it
periodically to see the progress before it will finish do nothing.
After completion of the syncing process  do as follows

1. Edit /boot/grub/menu.lst (Only the Red line)

title           Debian GNU/Linux, kernel 2.4.27-2-386 >Boot from HDD1
root            (hd0,0)
kernel          /boot/vmlinuz-2.4.27-2-386 root=/dev/md0 ro
initrd          /boot/initrd.img-2.4.27-2-386
savedefault
boot

2. Add following lines at /boot/grub/menu.lst  under the previous
step(This time you will add all lines as follows)

title           Debian GNU/Linux, kernel 2.4.27-2-386 >Boot from HDD2
root            (hd1,0)
kernel          /boot/vmlinuz-2.4.27-2-386 root=/dev/md0 ro
initrd          /boot/initrd.img-2.4.27-2-386
savedefault
boot

3. After saving these things run following commands
#grub
#root (hd0,0)
#setup (hd0)
#quit

4. Now Reboot the PC to see the new GRUB menu with Boot option from both
HDD, try to boot from both HDD individually and see that they will
updating the data on both disks .if boot from both HDD and updates all
then all will fine.

Advertisements

Posted in Disk Mirrorring, Linux Server | Leave a Comment »