Recently due to the fact that some of my bigger clients needed their VPS’s updated I decided to start fully cloning their servers so that in case of any issues I could simply change their DNS records to the new backup server and put them back online as fast as possible if something should go wrong during the repartitioning process. This goes especially if you are running cPanel. While you can always get more RAM and CPU for your VPS your hard drive needs to be repartitioned.

1. Setup and requirements:

Before proceeding, ensure that you have met the prerequisites below:

  • Both servers need to be running the same release of the operating system i.e CentOS 7.xCentOS 8.x, make sure you do not forget to check this or create the exact same backup VPS.
  • Additionally, the servers should have identical file systems and the same hard disk configuration either single-disks or in RAID configuration. Now if you are using VPS’s for both it’s 99% that both configurations are the same. Please note that you do not need the same about of hard drive space. For example, My primary server has 800GB of SSD but only uses about 300GB of it. So my backup server has 400GB and everything is fine.
  • Rsync installed on both servers (you can check your rsync version with
    rsync --version

    or simply install it by using

    sudo yum install rsync

2. Configuring the source server:

This title might be a bit much, all we are going to “configure” here is to make an exclusion list. We will exclude some folders that we do not need to copy over thus saving time while doing a copy.

It’s best to create a plain txt file on your source server by typing:

nano /root/excludedfiles.txt

Once open just copy and paste the following list and save the file


3. Cloning the CentOS server

sudo rsync -vPa -e 'ssh -o StrictHostKeyChecking=no' --exclude-from=/root/excludedfiles.txt / REMOTE-IP-OF-THE-BACKUP-SERVER:/

Replace the REMOTE-IP-OF-THE-BACKUP-SERVER with your server’s IP address and hit enter. Then just enter your root password (for the backup server) and wait till the cloning is done.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.