cloning the server using rsync

braindump of things to do/directories not to copy when cloning physical debian to a vm using rsync

warning – below is very much server dependent; stop all the ‘moving parts’ – in my case – cron jobs, mysql server.

  • prepare destination system – do proper partitioning, install the base system
  • assign temporary address to the new server so old and new one can talk one to another
  • run on both machines:

    apt-get install rsync
    /etc/init.d/cron stop; /etc/init.d/mysql stop # very much server-role dependent
    
  • run on the old one:
    cd /
    rsync --exclude dev/ --exclude proc/ --exclude lib/modules --exclude sys/ --exclude etc/fstab  --exclude etc/udev --exclude boot/ --exclude etc/mtab --exclude etc/lvm/ --include ".*" -Rav --delete -e "ssh -c arcfour " ./ root@newServer:/
    

One Comment

  1. Thanks for this post! I was thinking about how to get a total rpegross for rsync for quite a while, and this finally encouraged me to just do it. Until rsync includes some total rpegross functionality, this is quite nice. I wanted to also get the original rsync output in the Terminal, so I made a slightly different version, and used Perl rather than awk, because I know it better. In case someone finds it useful, here is the version I’m using.

    #!/usr/bin/perl    
    ## Parse rsync  verbose  rpegross output for zenity     
    $|++;     
    while () {        
     warn $_;        
     if ( m|^s+.*to-check=(d+)/(d+)| ) {            
      printf "%.0f", 100   (100 * $1 / $2);        
     }else {            
      print "#$_";        
     }    
    }
    

Leave a Reply

Your email address will not be published. Required fields are marked *

 

(Spamcheck Enabled)