?
Solved

Clone a Production HD

Posted on 2003-03-19
5
Medium Priority
?
196 Views
Last Modified: 2013-12-06
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
Comment
Question by:NateDavis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 20

Expert Comment

by:Gns
ID: 8175148
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
 

Author Comment

by:NateDavis
ID: 8175254
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
 

Author Comment

by:NateDavis
ID: 8175379
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
 
LVL 20

Accepted Solution

by:
Gns earned 300 total points
ID: 8175596
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
 

Author Comment

by:NateDavis
ID: 8391833
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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
If you don't know how to downgrade, my instructions below should be helpful.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question