[COLUG] Cloning Linux systems?

Jim jep200404 at columbus.rr.com
Wed Jun 23 19:10:24 EDT 2004


peter kukla wrote:

> What is the best way to clone a new Linux system, and
> maintain the changes to the system over time?

To maintain changes over time, rsync works well, whether 
source and destination are on the same machine, or on 
separate machines over a network.  rsync is particularly 
good at sending only the changes to minimize bandwidth.  
This will be particularly desireable for updates over the 
phone line.  

   rsync -aH -e ssh local/dir pkukla at remote.host.com:mirror

The command line syntax of rsync requires study.  

> I have purchased 2 identical computers.  

For the initial cloning of truly identical drives, 
the easiest way is to use dd from tomsrtbt or Knoppix 
with a command something like: 

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

If cloning with Knoppix, be darned sure to NOT let it 
have a swap partition on either hard drive.  Use much 
RAM instead.  
The above command copies all the sectors, include the 
partition table, boot stuff, and all the partitions.  
Some folks are concerned about dd not catching some 
low level errors.  You could run commands like: 

   dd if=/dev/hda | md5sum --
   dd if=/dev/hdb | md5sum --

several times each, to verify that the source and 
destination drives have absolutely the same content.  
Sometimes dd does a poor job of figuring out where a 
hard drive ends, so you might want to tell dd exactly 
how big your drive is with the bs and count options.  
If the drives do not have the same geometry, then dd 
will not work for you.  You'll have to partition the 
drives separately, mount the partitions and use rsync 
to copy files.  You'd also have to install the boot 
loader separately on the second drive.  

Another, likely faster way to verify simultaneous 
content of files (but not their metadata) is to use 
rsync with -c option.  



More information about the colug mailing list