Cloning a server with rsync is a reliable way to replicate your Breeze configuration, files, and data to a new instance. It handles incremental transfers efficiently and preserves file permissions.
Prerequisites
- SSH access to both source and destination Breeze instances
- rsync installed on both servers (usually pre-installed)
- Sufficient disk space on the destination
Basic Full Server Sync
Run this from the destination server, pulling from the source:
rsync -aHAXvz --progress \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
root@source-ip:/ /mnt/clone/
The flags explained:
-aarchive mode (preserves permissions, ownership, timestamps)-Hpreserves hard links-Apreserves ACLs-Xpreserves extended attributes-vverbose output-zcompression during transfer
Sync Specific Directories
To clone only web and database directories:
rsync -avz root@source-ip:/var/www/ /var/www/
rsync -avz root@source-ip:/var/lib/mysql/ /var/lib/mysql/
Incremental Updates
Run rsync again before the final switchover to catch recent changes:
rsync -aHAXvz --delete \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*"} \
root@source-ip:/ /
Post-Clone Steps
- Update
/etc/hostnameand/etc/hostswith the new server identity - Regenerate SSH host keys:
sudo dpkg-reconfigure openssh-server - Update network configuration for the new IP address
- Reconfigure any services that bind to specific IPs