Ubuntu – Clone system and auto replicate the changes

backuprsync

Is it possible to clone an Ubuntu system and if any changes are made to original system, those should be replicated to the one cloned? I need to have backup support if original one gets down. In my case, Ubuntu is a cloud server.

Please guide me step by step.

Best Answer

  • I would use rsync with SSH keys over the network and set it to run frequently with cron. This way, only the changes need to be transmitted.

    Format taken from how do I do mass installs?

    #!/bin/bash
    rsync -avx --exclude=/proc --exclude=/dev --exclude=/tmp --exclude=/sys --delete-after root@${host}:/ /
    

    On the machine that will serve as a backup, make a file named /etc/cron.daily/backup-pull then make it executable sudo chmod +x /etc/cron.daily/backup-pull. Replace ${host} with the IP of the original system.

    You'll have daily syncs of the original server to this one. You could also do cron.hourly instead of cron.daily if you're really paranoid.

  • Related Question