Failing system drive: mirror or clone to new drive via cp and rsync and grub configuration
Hi,
i am running Debian Sarge on a server.
I just had a server with a failing system drive /dev/hda. In particular errors
write errors from the /var partiton = /dev/hda7.
I decided to clone the system drive to /dev/hdb and I wanted to document, for
others benefit, what I did.
my drive /dev/hda had the following partitions:
/boot /dev/hda1
/ /dev/hda2
/home /dev/hda3
swap /dev/hda5
/tmp /dev/hda6
/var /dev/hda7
1) I put a new blank drive in the system, at /dev/hdb.
2) I ran cfdisk to create a mirror of the partitions on a on the new drive.
3) I then ran mkfs.ext3 on the different partitions /dev/hdb1 -/dev/hdb7
except /dev/hdb5.
4) I ran mkswap /dev/hdb5.
5) For each of the partitons /dev/hdb's
a) I mounted it partition on /mnt
b) I then ran cp -a (same as -dpR) for each one
cp -a /boot /mnt &
except for the / partition:
c) for the / partition (/dev/hda2 and /dev/hdb2)
i instead ran
rsync -a --exclude=/proc/* --exclude=/boot/* --exclude=/home/*
--exclude=/mnt/* --exclude=/tmp/* --exclude=/var/* / /mnt &
The reason I did differently for the / partition was to avoid copying the
other partitions. This is not neccesary if you are doing a mirror via a
knoppix on the cd cause then the root partition is not mounted,
6) then I ran
grub
and at the grub shell i ran:
grub> root (hd1,0)
grub> setup (hd1)
grub> exit
7) I then shutdown the system and removed the /dev/hda device and moved
the /dev/hdb to the /dev/hda position
(Ie moved the slave drive to the master position on the primary ide
controller).
8) The system then rebooted and continued to run without a stop.
Thanks for all the help I found in this and other forums.
MItchell laks
Reply to: