[CentOS] Add RAID after install in one disk

James Olin Oden james.oden at gmail.com
Wed Feb 28 13:12:08 UTC 2007


On 2/28/07, Mário Gamito <gamito at gmail.com> wrote:
> Hi,
>
> I had this hard time installing a server with RAID 1 by software.
> I always got an error from GRUB and no booting.
>
> So, i've installed CentOS 4.4 normally in only one disk.
>
> Question is: is it possible now to make a RAID 1 by software with the other
> disk ?
>
> If so, how ?
>
> I'm completely lost here.
>
> Any help would be appreciated.
Yes, though I don't think you can just directly convert your non md
devices to md devices.
I could be wrong, and if so someone merrily show me the error of my ways.

Now here is what I would do:

   1) Create the same partitions on the other disk (even you swap
partition), except set
       their type to autoraid (0xfd).
   2) Now using mdadm (read man page) create your md devices, but each
       with only one member comming from the newly created partitions.
   3) Activate the md devices.
   4) Now if your using LVM, change the appropriate md devices into
pv's and then create
       your volume group(s) and logical volume(s).
   5) Lay down filesystems on lv(s) and/or the md(s).
   6) Using tar or cpio, copy the files from your running systems
filesystems to the ones
       that are now sitting md devices (if only indirectly through lvm
on top of md's).
   7) Setup grub on the running system (i.e. not the drive you have
participating in md
       devices) to boot the kernel off of the md device your kernel is
in, and to have that
       kernels root filesystem be from the root filesystem sitting on
an md device.
   8) Now reboot the system; this shoudl boot from the md devices.
   9) Using fdisk change the non md device partitions to type autoraid.
   10) Now add this partitions to the md devices as members of the raid sets.
   11) At this point you should have the contents of the second disk
syncing to the first.
         Let this finish (you can monitor it by looking at /proc/mdstat).
   12) After this edit the grub.conf again to use the md devices.
   13) Install the grub boot loader on your second disk also.

As an aside, the grub side is really the trickiest part of this,
because though you want to boot the kernel off of the other disk after
you've created you initial md devices in degraded mode, you are
actually going to boot grub from the first disk, and then aquire your
kernel from the second.  At the point the disks are synced, then you
will be back to your old grub
configuration, because you haven't changed that on the raid side
(though you could I suppose), and so you have to rechange the grub
configuration again.

Anyway this is a rough outline.  I have purposely avoided giving you
specific commands and such, as the reading of the man pages is your
responsibility.   Also, there are places in here where if you do the
wrong thing your system is toast, and your remedy will likely be to
re-install.  So YMMV and good luck...james


>
> Warm Regards,
> Mário Gamito
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
>



More information about the CentOS mailing list