Robert De Mars wrote:
> I was curious if anyone knew of a good how to that explains the steps
> for moving an existing non-raid system to a RAID 1 setup.
>
> The system currently has an 80G hard drive running Slackware 12.1.
>
> I would like to move the file system from the 80G hard drive to a RAID 1
> setup using 2 x 500G drives, and then toss the 80G in the trash.
>
> If any one knows of a document(s), I would greatly appreciate it.
Here are my notes-to-self from when I did the same thing. This was on Debian.
This should at least sketch out the general process...
* Initial drive is in hda.
* Installed one of the new drives in hdc.
* I partitioned hdc with 4 primary partitions to be / (md1), /tmp
(md2), /var (md3), and swap (md4) all with partition type 0xfd. This means
swap will be on RAID as well. Probably would be easier to use a swap file
rather than a swap partition, but this is how I did it.
* Used mdadm to create md1 as RAID1 array of /dev/hdc1 with the second
device listed as "missing" so it would come up in degraded form.
* Did the same for md2, md3, and md4
* Added the new arrays to /etc/mdadm/mdadm.conf
* Mounted the new arrays for /, /tmp, and /var under /newsys/,
/newsys/tmp, and /newsys/var
* Copied most everything over to newsys by cd'ing to / then issuing
"tar -c bin boot etc home mnt usr {...etc} | ( cd /newsys ; tar -xvp )".
Where {...etc} means the rest of the directories in the root dir which I
wanted to copy. Directories I did not copy were /dev, /proc/, /newsys, /sys.
* Made directories dev, proc, sys under newsys as mounting points
* Copied the basic dev files by binding / (the root) to /tmproot to
get at the actual dev files hidden by the udev system, (e.g. mount --bind /
/tmproot ), then using the same tar pipe to copy from /tmproot/dev to
/newsys/dev. I don't know how important this step is, but seems like it
might be necessary to hold things until udev comes up on boot.
* Edited /newsys/etc/fstab to switch to the new arrays
* Edited /newsys/boot/grub/menu.lst to direct grub to (hd1,0) for
root, and change the kernel params to say root=/dev/md1
* Ran in grub shell: "root (hd1,0) ; setup (hd1) ; setup (hd0)" so
both drives mbr's would look to /dev/hdc1 for the root filesystem to boot.
At this point I could still boot back into the old system by changing grub
to root (hd0,0). (Which I did several times since I forgot to create
directories for proc and sys without which the boot up failed.
* Once booting into the new arrays works well, install second new
drive in /dev/hda and fdisk it to make it match the other drive and set the
types to 0xfd (raid element)
* I hot-added the hda partitions into the arrays (e.g. mdadm -add
/dev/md1 /dev/hda1, etc.) and watched while it synched everything.
* I added the hda partitions into /etc/mdadm/mdadm.conf
* I ran grub and did a root (hd0,0) ; setup (hd0) so that grub on each
mbr would look to it's own drive for the root system. Then if one drive
dies completely I should still be able to boot off the other.
* I reboot a couple times to make sure everything would come up ok.