Thursday, 18 August 2016

Server Cloning via rsync

Server Cloning and Manual Backup::
rsync is a file sync application which is faster than copy commands and retains the permissions which is best suited to clone a live server or while restoring a server from the backup.

When running an rsync command, the first thing that should come after rsync is the desired switch or switches. Common switches include:

-r :Recursive; includes sub-folders
-a :Archive mode; includes sub-folders, while preserving permissions, groups, users, and times
-v :Verbose; the entire process is printed to the terminal rather than remain hidden
-e :Execute; calls upon an application required to make a connection, such as SSH
-c :Sync based on checksum – takes a while for a lot of files, or large files.
-z : compress file data
-h : human-readable, output numbers in a human-readable format
 --delete : If the destination have new files than source, it will be deleted
 --include : include particular files during rsync
 --exclude : remove particular files from rsync
 --progress : shows the progress during rsync
 --max-size='100' : only the files have the maxfile size or lesser will rsynced
 --remove-source-files : delete the source file after the rsync
 --bwlimit=100 : Set the bandwidth limit of the rsync.

Eg: rsync  switches  source destination
       rsync -aveczh /source/  /destination/

Please try to understand the following commands with the switches added.  These are just examples as you could understand if you understood the logic.

# rsync –r /home/source/ /home/destination/
# rsync –a /home/source/ /home/destination/
# rsync –av /home/source /home/destination/ # rsync –av ––delete /home/source/ /home/destination/
# rsync –av ––delete -e ssh root@ /path/destination/
# rsync –av ––delete -e ssh root@targetipaddress:/remotesource/ /localdestination/
# rsync -zvh /source/backup.tar /destination/backups/
# rsync -avzh /home/source /home/destination/
# rsync -avzhe ssh --progress /home/sourcefile  root@
# rsync -avze ssh --include 'R*' --exclude '*' root@ /root/rpm
# rsync -avz --delete root@ .
# rsync -avzhe ssh --max-size='200k' /var/lib/rpm/ root@
# rsync --remove-source-files -zvh backup.tar /tmp/backups/
# rsync --bwlimit=100 -avzhe ssh  /var/lib/rpm/  root@

Some of the backup applications that does cloning are as follows::
1. Clonezilla - debian linux
2. Partimage

No comments:

Post a Comment