cloning or saving system

source : debian-user-digest # 1191,1203,1204.

How can I clone/transfer my current working machine with all it's files/programs like thunderbird/iceweasel etc to the another machine and still retain a working system ?

[ A ] : put the old HD into the new computer, boot up to Linux ( you might have to edit Grub at this point ) then dd the MBR to the new drive on the new computer, then sync the rest of the drive either using rsync, copy or dd. Then move the HD's back in their original places and edit grub again.

[ B ] : you could just use Clonezilla.

[ C ] : if you want to have a basic clone ( not an exact copy ) of a machine, what I end up doing ( which allows me to provision a machine in about 15 minutes ) uses the following procedure :

Step 1 : Create a package list on the old machine [*]

$ dpkg --get-selections | grep -v deinstall > pkglist.hostname

Step 2 : ( Optional ) Capture the drive layout [*]

$ df > driveinfo.hostname

$ df -h >> driveinfo.hostname

# fdisk -l >> driveinfo.hostname

Step 3 : Build the new machine with the netinst or businesscard cd. When asked what type of system to build ( package selection ), uncheck all the boxes.

Reboot into your new system, copy pkglist.hostname from step 1 onto the machine. I usually copy at least /etc/apt/apt.conf, /etc/apt/sources.list ( I use a universal one, so one size fits all ), and /etc/apt/sources.list.d over. Do the following :

# dpkg --set-selections < pkglist.hostname

# apt-get dselect-upgrade

This should give you a system with a nearly identical set of packages that you can then tweak to your hearts content.

[*] You can actually back these files up and have a pool of different "types" of machine. For instance, I have a workstation packagelist, a laptop list, as well as lists for the various types of bastion hosts in my network, including a wiki host (mediawiki), firewall, backup server, etc.


[ D ] : if you are managing more than a few boxes, you also might want to consider a configuration management tool like cfengine or puppet. Then you could "script" all of your UIDs and GIDs as well as other configuration details. For instance, I have a list of "essential" packages ( essential for me ) that I install on every box. With cfengine, I can automagically install them as well as edit/modify that list in one place.

Finally, backing up /etc and restoring it later prevents you from having to do all the configurations again.
Be careful with that. Especially if you are "cloning" a box that has been around for a while. Carte blanche copying of /etc can lead to problems. There is the problem of "etc drift," even with a fairly recently built box.
 
 
Creative Commons License
This work by maniac.vardhan is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
 
 

0 comments :: cloning or saving system

Post a Comment