• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

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...
0
NateDavis
Asked:
NateDavis
  • 3
  • 2
1 Solution
 
GnsCommented:
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
0
 
NateDavisAuthor Commented:
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
0
 
NateDavisAuthor Commented:
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
0
 
GnsCommented:
man dump
man restore

What you'd do is write the dump (of level 0) to stdout, and pipe it straight into restore. The important thing is to make the restore to the correct partition (ie not the one you are reading from:-).
Something like
dump -0af - /dev/hda2 | (cd /mnt/newroot; restore -rf -)
dump -0af - /dev/hda1 | (cd /mnt/newroot/boot; restore -rf -)
provided that you have mounted the new root on /mnt/newroot, and the new /boot on /mnt/newroot/boot.
You might need to give the -I option too, to increase the number of read errors dump accepts befor bombing out.

If it does bomb out, you can simply just remake the filesystem and rerun with dump -0aIf 64 - ... (64 is just an example).

If you are unlucky, and the drive has debris scratching the surface... things might not go so well, so ... brace yourself:-).

-- Glenn
0
 
NateDavisAuthor Commented:
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now