Link to home
Start Free TrialLog in
Avatar of s1m0ne
s1m0neFlag for United States of America

asked on

Linux System Cloning

Hey thanks in advance for any input. I need to clone a linux server that is at risk of dying. It is running  Fedora Core 3, it runs several ODBC and Mysql queries that are vital to the company, I tried setting up another machine running centos 4.5 and copying the scripts for DB generation and etc to the new machine, but I could not match the setup exactly with ssh keys, users and permissions to get it to work.

I did a clone of the hard disk using dd that worked fine on the same system, but it does not work if I place it in a different machine, even if the specs on the machine are similar.  The system boots but the kernel panics before anything gets going.

I can post error messages if I am on the right track, but please somebody point me in the right direction on how to setup this clone server that can be plugged in to replace the current one in case of complete failure.

Thanks

ASKER CERTIFIED SOLUTION
Avatar of Michael Worsham
Michael Worsham
Flag of United States of America image

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
Avatar of madunix
madunix

I use multiple tools to image linux system only (my best one is mondo) ,
1- use Mondo Rescue to clone linux systems: http://www.mondorescue.org
in order to image your system and create bootable CD/DVD download mondo for your distro
ftp://ftp.mondorescue.org  more info read this manual
http://www.mondorescue.org/docs/mondorescue-howto.pdf

2- You can use dd also. dd if=/dev/somedisk of=/dev/somedestination

3- rsync scripting

4- netcat
On the source server: (cd / && tar -cvf - ) | nc 192.168.1.2 2000
On the destination:: nc -l -p 2000 | tar -xvf -

5- http://sourceforge.net/projects/g4l/

madunix
Avatar of s1m0ne

ASKER

Thanks for the reply, I was able to clone the HDD into a new HDD, that is actually what is running on the system now, since I was running out of space on the meager 120 GB drive. My issue is cloning the system and making it run on different hardware. Is there a way to maybe recompile the kernel for the new hardware while keeping the rest of the setup intact?

I will look into setting it up in a virtual machine as mwecomputers has suggested, but I am not sure how that is going to work, since I don't have much experience in virtualization. Also would it be possible to transplant the setup from the virtual machine back to a piece of hardware, without VM?
As long as the hardware is not completely different (i.e.   going from a pentium III to an AMD Phenom2)  and you have the right modules for the hardware, Kudzu should be able to find them and add them to the kernel.   I have transferred linux hard drives between systems and it has come up without any additional user intervention.
Avatar of s1m0ne

ASKER

sr75, those were my thoughts exactly. Both machines are running on a P4 2.8, the original might have hyper-threading but I am not sure of that. The drive was cloned with DD, I am right now testing using the original HDD to avoid the chance of a corrupt copy. Yet this is what I get every time.

Uncompressing Linux... Ok, booting the kernel.
Red Hat nash version 4.1.18,1 starting
mkrootdev: label / not found
mount: error 2 mounting ext3
mount: error 2 mounting none
switchroot: mount failed:2
umount /initrd/dev/ failed: 2
Kernel panic - not syncing: Attempted to kill init!

PS: I just edited the GRUB configuration at boot from LABEL to /dev/sda2, that made the mkrootde line go away, the rest of the message stays the same.
Your /etc/fstab probably needs to be changed as well.   Can you boot into the shell or even run level 1?  
Avatar of s1m0ne

ASKER

No, the kernel crashes before anything even loads.  What I can do is boot using a live CD and make changes to the configuration files.  I am not sure if I can do something like run kudzu from a live CD that will affect the setup.

By the way, I tried setting up the virtual machine like it was suggested, for some reason it requires a 64-bit compatible CPU, and the one machine I have available the has that the network card is not compatible...

Try using VMware ESXi 3.5 as it was intended for supporting 32-bit CPU processors...

VMware ESXi 3.5:
https://www.vmware.com/tryvmware/?p=esxi&lp=1

You can use the same conversion steps for this ESXi environment as well.
Ghost can clone same size HDD... just use the /ir parameter...
Avatar of s1m0ne

ASKER

Thanks for the replies, but my problem is not cloning the drive, that I was able to do sucessfully a few times using DD. My issue is making the cloned drive work with the new hardware, the hardware is similar to the one on the original machine.

So far I am leaning towards setting up a VM machine as it was suggested earlier, but ESXi is extremely picky as far as hardware. I am trying to set it up on a new machine I have setup as a test server, but it is not a brand built server, but something that was bought in pieces and put together. The install is hanging at the network adapter, I tried a few of the shelf cards, but none work.

When all else fails, take a look here for seeing if the hardware you are using is compatible...

VMware Compatibility Guide (HCL) Site:
http://www.vmware.com/resources/compatibility/search.php

Avatar of s1m0ne

ASKER

Ok, the new network card installed fine with ESXi, Let's see if I can clone the server into a VM server.
Avatar of s1m0ne

ASKER

The install of ESXi worked with no problem, I am cloning the server, should be done in a few hours. How do I manage it? Just by SSH'ing into it? Is there a way to see the gui of the OS from a windows or Linux machine?

Thanks
Navigate to the VMware ESX Server 3 welcome page using the URL listed on the console and click the "Download VMware Infrastructure Client" link. Through the VI client, you can control and configure your ESXi server and all of the guest VMs.

NOTE: The VI client only runs on a Windows platform.

Additional reference:
http://www.oracle-base.com/articles/misc/VMwareESXServer3Installation.php
http://www.petri.co.il/how-do-you-install-vmware-esx-server-3i-esxi.htm
Avatar of s1m0ne

ASKER

The system is almost fully working running on the VM server, the only thing that caused a problem is a ODBC connection with a proprietary DB, but everything is working with no problems. Just to clarify something, the ESXi server is free, but the vSphere client runs about $1000 a year registration?
Since is working I might get my boss to get the license, but free is always nice!
Hmm. That shouldn't be right. I have VMware ESXi 4 environment running at home and there is no cost for the client. All I had to do was connect to my ESXi server's URL IP address and download/install the VMware vSphere client. From there I can do pretty much what I need to do.

Using the vSphere 4.0 Client to Manage ESXi 4.0
http://www.petri.co.il/managing-esxi4-with-vsphere-client.htm

However: I do know that if you want to use the VMware vCenter Server to control the ESX and ESXi environments, then that agent/client needs to be licensed.
Avatar of s1m0ne

ASKER

The server is fully functional ! The issue was the network card was polling for a different MAC, all I had to do was probe for the new MAC and everything worked! Thanks
Glad I could help :)