How did you arrive at that partitioning scheme? Is there any other disk installed in the system (eg. running Windows)? Where is the boot loader installed (check /boot/grub/menu.lst)? Do you have a working backup of any important files on the machine (not only on the Linux disk, but really the complete machine)?
Is this a testing machine based on an production machine, and you want to apply the mirroring procedure to the production machine later? Or is it just for experimenting? If the later, I'd say scrap it and set up mirroring during the installation (less hassle).
Ok, we could go on forth an back for a while now, but I think that would be rather tiresome. So please, post as much information about the systems as possible. Otherwise the probability is very very high that whatever advice we give will screw up your system.
What's the partitioning layout on the production server?
Did you replicate the layout on the test machine?
Is the test machine a physical or virtual one?
Do you only want to mirror the root partition or others too?
Do you, at any point in the foreseeable future, plan to switch to LVM to manage your disks?
What boot loader are you using (Grub, LILO) and where is it installed (MBR, first partition)?
Partition lay out is same on both production and development.
We do not have any plans to migrate to LVM.
Boot loader is grub.
It is a physical machine.
I want to mirror / & boot (Or these separate ? I dont know, My df is not showing separately).
Hello mate,
..to mirror disks you should use a volume manager as is mentioned above (LVM will do you) -you will need to build logical devices that you can manage - mirror or what ever.
You will need a disk manager get sorted anyway to manage SAN/NAS devices if required- well I dont see any local application moutpoints there.
Your df -h shows me that you having only default linux install/build set up - this does not look like layout of production or test server to me.
Simply you need to re-think the project, partition the disks right, then grab the slices and build the logical devices, and then mirror the devices accross the controllers...
I think you can do the all the low lever work easy in YAST..
Alright. I've asked about the partition layout since it seems quite strange: 3 logical partitions (2 Linux + 1 Swap) inside an Windows extended partition isn't what you usually find in an production environment. A virtual machine might have been better for testing, since you could create snapshots to go back to if a step fails.
I'll try to create a suitable checklist/how-to, but it might take some time. Things like this shouldn't be rushed...
---------- Post updated at 17:01 ---------- Previous update was at 12:39 ----------
Alright, I think I've got it.
DISCLAIMER:
This procedure is extremely dangerous and should not be applied to any production server without a proven good backup. Neither I nor this site can be held accountable for any data loss you might encounter. Really.
Boot to "Rescue mode" using the installation CD
Replicate the partition layout: text sfdisk -d /dev/sda | sed -e 's/sda/sdb' | sfdisk /dev/sdb
Change the partition type of /dev/sdb6 to "RAID autodetect" text echo -e "t\n6\nfd\nw" | fdisk /dev/sdb
Create the array with 1 disk missing (will be added later) text mdadm --create /dev/md0 -l 1 -n 2 -x 0 /dev/sdb6 missing
#
Create a filesystem on it text mkfs -t reiserfs /dev/md0
Mount the old and new "root" text mkdir /tmp/old mount /dev/sda6 /tmp/old mkdir /tmp/new mount /dev/md0 /tmp/new
Copy over the old contents (could take a while) text cd /tmp/old find . -xdev | cpio -pmdV /tmp/new/.
Cross your fingers, because after the next step the original system is probably not salvageable.
Unmount the old "root" and change the partition type text cd /tmp umount old echo -e "t\n6\nfd\nw" | fdisk /dev/sda
Add the "old root" to the array so it can rebuild in the background text mdadm --add /dev/md0 /dev/sda6
chroot into the new array to make needed changes. Do not exit the chroot until told to do so text chroot /tmp/new
Mount some needed stuff text mount -t proc proc /proc /etc/init.d/boot.udev stop & /etc/init.d/boot.udev start
Replace sda6 with md0 in these files: /boot/grub/menu.lst, /etc/fstab
Install Grub on both disks (the '>' indicate to enter this at the Grub prompt and are not part of the command) text grub > root (hd0,5) > setup (hd0) > root (hd1,5) > setup (hd1) > quit
Create a suitable mdadm.conf text echo "DEVICE partitions" > /etc/mdadm.conf mdadm --examine --scan >> /etc/mdadm.conf
Rebuild initrd (replace xxx with the appropriate file) text cd /boot mkinitrd -k vmlinux-xxx -i initrd-xxx
Umount and exit the chroot text /etc/init.d/boot.udev stop umount /proc exit
Check the rebuild status with mdadm --detail /dev/md0