How to copy a whole system to a new machine

Asked by PeterDz

A system rebuild is needed urgently to transfer the contents of an existing Ubuntu server machine to a replacement. I have a dim recollection, but can't remember exactly where I came across it, that there is a way of copying a whole system (settings and all) from one machine to another. Am I right (if so how do you do it?) or am I just suffering from delusions???

Peter

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu ubiquity Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :
#1

If the drives are the same size, you can use the dd tool to do a low level duplication of one block device to another. You may wish to install the "pv" program in order to get pretty progress bars.

http://elevenislouder.blogspot.com/2010/10/manual-backups-in-linux-dd.html

Revision history for this message
mycae (mycae) said :
#2

I think this also works if the target disk is larger than the source, but I cannot recall. It certainly does not work the other way around, obviously.

Revision history for this message
PeterDz (pdzwig) said :
#3

mycae, thanks. My problem is to copy all low-level system stuff such as server settings, additional software etc., the main disks are all external and can (hopefully) just be swapped as they were set up to be as independent as possible of the hardware. But thanks.

Peter

Revision history for this message
delance (olivier-delance) said :
#4

You can also use Gparted to copy from one disk to another a partition.
If needed, you can before, reduce size of original partition, always with Gparted.
But you will have to reinstall Grub2: https://help.ubuntu.com/community/Grub2#Reinstalling%20from%20LiveCD

Revision history for this message
mycae (mycae) said :
#5

PeterDZ:

I guess I am confused what you mean by server settings an additional software... This would be installed on the hard disk, unless you are referring to on-board controllers.

If you are referring to onboard controllers, your supplier should hopefully have shipped you a rescue type CD to allow you to do this, otherwise the dd solution will work -- just run it against the drive with the OS on it (preferably from a liveCD, so the drive is not actively mounted at the time!).

Revision history for this message
mycae (mycae) said :
#6

Alternately, if you don't want to clone the system, often you can just move the hard drives, and linux will redetect your hardware and keep running -- sometimes it needs a poke (eg network adapters changing names), but often you can just get away with this.

This is a benefit of a somewhat monolithic kernel -- all the drivers are often just there...

Can you help with this problem?

Provide an answer of your own, or ask PeterDz for more information if necessary.

To post a message you must log in.