Click to See Complete Forum and Search --> : mirror hard drive


sb
11-26-2002, 07:14 PM
Hi,

I have two computers that are identical (computer A and B) running RedHat 7.1.

Computer A's hard drive fails so I have to replace it.

What I want to do is install a new hard drive (IDE) on computer B as hdb. Then mirror hda to hdb. Remove hdb and install it as hda on computer A.

I've installed the new disk hdb, partitioned it and created the file system (ext2). I've copied the files from hda to hdb.

When I install the drive on hda I can't get the system to boot to the drive. I've made the /boot partition bootable. I did edit the /etc/fstab so that it is correct for the new drive (I think).

Do I need to copy the MBR also? How do I do this?

When I copied the file system I didn't copy /proc because it is a virtual file system. I did create an empty directory called /proc. Are there files in /proc that need to be copied?

Thank you,

mdwatts
11-27-2002, 06:41 AM
If /boot was the bootable partition on the original drive, then the Linux bootloader was not installed in the mbr.

Can you boot into your system using a bootdisk?

If you can, then check your /etc/lilo.conf and then run /sbin/lilo to rewrite to disk.

BTW... How did you copy hda to hdb and did you copy over all partitions?

What errors are you getting when booting?

LinuxLuke
11-27-2002, 09:45 AM
well, from my windows days (you know, last week :p) i tried to just copy a drive to another, and some of the files didn't and couldn't copy, so the new drive was unbootable, not sure if this'll be of any use, but anyway...

Luke

sb
11-27-2002, 07:50 PM
We have four partitions on these machines.

swap
/
/boot
/usr

I mounted the drives in /mnt/drive4 and copied the contents of the existing partion to the directory

So for /boot I copied
cp -R /boot/* /mnt/drive4/

For / I had to copy the individual files such as
mount /dev/hdb2 /mnt/drive4
cp -R /var /mnt/drive4
cp -R /etc /mnt/drive4
cp -R /root /mnt/drive4
etc...

when I tried booting to the new disk I had the problem that the system wouldn't boot to drive. It would try to boot to the CDROM.

--------

Welll since the time that I fiddled with the system some more. I installed the new drive and installed redhat7.1 on it. I had thought that I could install GRUB and then when I copied the files over I'd not have problems booting...

I think that I made a mistake since now when I plug the old hard drive in as a slave I can't boot because of a kernel panic.

I need to play with this some more before I can make an intellegent guess about how to repair it. I'll post back here when I've made progress.

mdwatts
11-28-2002, 07:05 AM
Since you have three separate partitions and using 'cp' to copy over the contents, you should create the destination partitions on the new drive first.

Create

/
/boot
/usr

on the new drive and then copy over /boot to the new /boot partition and then repeat for the other two.

Use fdisk and then mkfs.ext2.

mkfs.ext2 /mnt/new-drive/new-partition

or for ext3

mkfs.ext2 -j /mnt/new-drive/new-partition

You may need to manually create the swap partition. Let me know if you need the commands for that.

After getting everything copied over, mount the new /boot partition and make any modifications to /boot/grub/menu.lst as required.

Next mount the new '/' and also make whatever changes are required in /etc/fstab.