LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Clone Server to New Hardware (https://www.linuxquestions.org/questions/linux-server-73/clone-server-to-new-hardware-707176/)

dzollinger 02-24-2009 12:28 PM

Clone Server to New Hardware
 
I have a older Gentoo qmail server that is dying from the rapid growth of our email requirements. We are eventually migration to a brand new Exchange Server (different story). But in the mean time (4 more months) I need to get the current system stable. We are getting lots of hard drive issues and the server is unable to handle the SPAM/AV scanning it's doing.

What I would like to do is clone the system over a new server (more RAM, faster CPU). My question is: What is the best way to handle this? I am not worried about trying to adjust partition sizes so I was planning on using dd and plug the clone into the new server and see what happens.

Is there a chance this will actually work? Or are the major hardware changes going to wreak havoc on the server?

Any suggestions would be appreciated.

Thanks,
David

kentyler 02-24-2009 01:22 PM

That all depends on what type of hard disk you have and what hard disk controller.

I have in the past put a second hard disk into an ide machine and ran:

cat /dev/hda > /dev/hdb

This clones all partitions and makes an exact copy. You will of course need to do some modifications to the drive if you plan on using additional space in the event of a bigger drive.

With scsi disks that do not share the same controller you may need to boot to rescue and load a driver and then build a new initrd image.

dzollinger 02-24-2009 01:30 PM

The current server has an IDE hard drive. The new server has a SATA hard drive. No RAID controllers involved.

kitek 03-09-2011 02:11 AM

Quote:

Originally Posted by kentyler (Post 3455918)
That all depends on what type of hard disk you have and what hard disk controller.

I have in the past put a second hard disk into an ide machine and ran:

cat /dev/hda > /dev/hdb

This clones all partitions and makes an exact copy. You will of course need to do some modifications to the drive if you plan on using additional space in the event of a bigger drive.

With scsi disks that do not share the same controller you may need to boot to rescue and load a driver and then build a new initrd image.

I want to do something like it. I just want to copy To make an exact server just on different hardware. Assuming hda is the current primary drive in the system to back up right? and hdb is the slave I put into the box to copy too right? so then take out the hdb and place it in the new box and boot and it should be just like the other right just different hardware?

crispinux 03-09-2011 10:00 PM

if all you want is to clone the hda disk to the hdb you can use "dd", just be sure both hard drives are unmount.

dd if=/dev/hda of=/dev/hdb

kitek 03-09-2011 10:34 PM

Quote:

Originally Posted by crispinux (Post 4285001)
if all you want is to clone the hda disk to the hdb you can use "dd", just be sure both hard drives are unmount.

dd if=/dev/hda of=/dev/hdb


Okay with that being said. I want to make sure I understand. I scenario I would like to work on tonight maybe you can lead me there. I have this one Centos box with only a 250GB hard drive in it. It's a low end P4. I have built a new server that doesn't have an O/S yet since I want the one I am now duplicated. If the source PC has only one drive, how do I unmount them and do the copy? It will go from the 250GB to a 500GB.

crispinux 03-10-2011 12:02 AM

ok, let me try to explain this a little more,

1.- you need to install both HD in the same machine.
2.- boot your machine with a live CD ( I like knoppix).
3.- open a shell session
4.- you can use the fdisk -l to see the disks
5.- ensure both drives are unmount.
6.- then use dd if=/dev/hda off=/dev/hdb

be really careful because the dd = disk destoyer
I use this only with disk to disk clone.

kitek 03-10-2011 12:15 AM

Quote:

Originally Posted by crispinux (Post 4285063)
ok, let me try to explain this a little more,

1.- you need to install both HD in the same machine.
2.- boot your machine with a live CD ( I like knoppix).
3.- open a shell session
4.- you can use the fdisk -l to see the disks
5.- ensure both drives are unmount.
6.- then use dd if=/dev/hda off=/dev/hdb

be really careful because the dd = disk destoyer
I use this only with disk to disk clone.


Okay got ya. Is there any problem going from a smaller drive to a larger for any reason?

crispinux 03-10-2011 01:43 PM

no I do that a lot of times, but the dd is a exactly copy of the old drive so if you want to use the remain space in the disk you need to create a new partition in the unused space

bryan641 03-15-2011 09:17 PM

When I needed to move my ext3 partition and resize it I used "dd" to backup and restore the partition. Then got it to recognize the new partition size with "resize2fs". No need to create an additional partition to use the new disk size.

--Bryan


All times are GMT -5. The time now is 11:38 AM.