Link to home
Start Free TrialLog in
Avatar of NateDavis
NateDavis

asked on

Clone a Production HD

This is my Problem...

I installed Red Hat 8.0 on a 15 gig HD.  It has been in production for about 3 weeks.  The machine boots normally and everything else seems to be normal.  By running dmesg, I found that I have a few bad sectors on my HD, which was a used HardDrive.  

dmesg Output (repeated quite a bit):
hda: dma_intr: status=0x51 { DriveReady SeekComplete Error }
hda: dma_intr: error=0x40 { UncorrectableError }, LBAsect=436935, sector=228088
end_request: I/O error, dev 03:02 (hda), sector 228088

From what I can tell, the Data that is on this sector is my 'rpmdb' and also my make or gcc because I get errors when I go to use make...
I have Apache and qmail for my SMTP with about 80 users.  This is what I was hoping to do...   Purchase a 40 Gig HD, and using 'dd' make a copy of my 15 gig and put it on my new 40 Gig then remove the 15 gig from the system and have it boot and have a usable system on the new 40 gig.

Am I dreaming or is this Possible?  Detailed instructions would be wonderful.  What Options with 'dd' would I use to make this work?  I do have access to Red Hat 8 CDs with Recovery Options...

Here is my Partition Table...  Using df -h  (I only have 3 Partitions...)

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2              13G  2.9G  9.9G  23% /
/dev/hda1              99M  9.2M   84M  10% /boot
none                  247M     0  246M   0% /dev/shm


Thanks for you Help...
Avatar of Gns
Gns

There's no need to limit yourself to dd:-)
Use dump2/restore or similar tool (cpio or a "tar-copy" might work out well too).

Place the 40 GB drive as slave or on the secondary, partition it with fdisk, make filesystems on the partitions... then use a backup tool like the above to copy the data.

Using dd is OK too, but it will limit you a bit (as to resizing partitions etc). There is also the problem that copying the MBR and partition table... well, it will not reflect the new drive:-). better to do something else.

In both cases you'll have to install a bootloader to the new drive... this might be simplest to do after you remove the faulty drive and move the new drive to primary master.

After you have made the move, there is still the problem of restoring the rpm packages that are suspect.
The rpm database on my testrigg with RH8 crashes regularily, so... it need not occupy the damaged area... or does a "rpm -qa" trigger the error?
If the db just crashed, do the following:
mv /var/lib/rpm /var/lib/rpm.org
rpm --initdb
cp -f /var/lib/rpm/rpm.org/Packages /var/lib/rpm/Packages
rpm --rebuilddb
This should restore things to useable for the rpm database.
Then force an update of the gcc package etc.

-- Glenn
Avatar of NateDavis

ASKER

Glenn,

Thanks so much for the Help.  I will be trying it tomorrow to see if your suggestions work.  

The Error is triggered when I run a make on a program.  I get some segmentation error.  If I run make like 5 times it finally will complete the actual make.  What started the whole thing was when I started to do a up2date and it gave me all these i/o errors.  I then tried the rpm --rebuilddb and that gave me some i/o errors as well....  So, where can I get some more information about dump2/restore?  I will check the man pages, but do you have any suggestions?  Thanks again for all your help...

Nate
Glenn,

Thanks so much for the Help.  I will be trying it tomorrow to see if your suggestions work.  

The Error is triggered when I run a make on a program.  I get some segmentation error.  If I run make like 5 times it finally will complete the actual make.  What started the whole thing was when I started to do a up2date and it gave me all these i/o errors.  I then tried the rpm --rebuilddb and that gave me some i/o errors as well....  So, where can I get some more information about dump2/restore?  I will check the man pages, but do you have any suggestions?  Thanks again for all your help...

Nate
ASKER CERTIFIED SOLUTION
Avatar of Gns
Gns

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your Help.  Using these tools I was able for the most part to get the Data that was crutial.  I just went out and bought a new computer, and re-installed Red Hat 8.0, and then using dump and restore moved the crutial data over.  Thanks again for all your help!

Nate