Gaurav Mishra
<gmishx@gmail.com>
Linux - 9
Backup using rsync
Unrestricted
01-03-2018
Gaurav Mishra <gmishx@gmail.com>
rsync
• rsync is a software in Linux
environment use to make disk
backups.
• Backups can be either local or on
remote machine.
• The uniqueness of rsync is that it
performs differential
synchronizations.
• Both the systems must have rsync
installed.
• rsync can use ssh secure connections
for transmissions.
01-03-2018
Gaurav Mishra <gmishx@gmail.com>
Using rsync
• Install rsync on remote and local machine
▫ sudo apt-get install rsync
• Creating archive on remote host
▫ Archive mode include recursive copy, sym links, permissions, time, group, owner
and device files.
 rsync -r -a -v ~/proj user@host:~/backups/
• Specifying remote shell
▫ Additional information for the remote shell used to setup connection can be set
using -e flag
▫ Setting the ssh port during transfer
 rsync -rav -e ‘ssh -p 2257’ ~/proj user@host:~/backups/
• Filtering files
▫ rsync can filter files to be copied using filter rules
▫ Filtering ‘.o’ files
 rsync -rav --exclude=“*.o” ~/proj user@host:~/backups/
01-03-2018
Gaurav Mishra <gmishx@gmail.com>
Using rsync
• Performing compression on transmission
▫ rsync can compress the transmission to save bandwidth
 rsync -z -r ~/project user@host:~/backups/
• Updating a backup
▫ Using update options, rsync will not transfer files which are new in the destination
 rsync -av <-u/--update> ~/project user@host:~/repository/
• Deleting old files
▫ rsync support delete option which removes files from the destination which are
not in the source
▫ To use this option, whole directory must be synchronized
 rsync -a --delete ~/project user@host:~/repository/
01-03-2018

Backup using rsync

  • 1.
    Gaurav Mishra <gmishx@gmail.com> Linux -9 Backup using rsync Unrestricted 01-03-2018
  • 2.
    Gaurav Mishra <gmishx@gmail.com> rsync •rsync is a software in Linux environment use to make disk backups. • Backups can be either local or on remote machine. • The uniqueness of rsync is that it performs differential synchronizations. • Both the systems must have rsync installed. • rsync can use ssh secure connections for transmissions. 01-03-2018
  • 3.
    Gaurav Mishra <gmishx@gmail.com> Usingrsync • Install rsync on remote and local machine ▫ sudo apt-get install rsync • Creating archive on remote host ▫ Archive mode include recursive copy, sym links, permissions, time, group, owner and device files.  rsync -r -a -v ~/proj user@host:~/backups/ • Specifying remote shell ▫ Additional information for the remote shell used to setup connection can be set using -e flag ▫ Setting the ssh port during transfer  rsync -rav -e ‘ssh -p 2257’ ~/proj user@host:~/backups/ • Filtering files ▫ rsync can filter files to be copied using filter rules ▫ Filtering ‘.o’ files  rsync -rav --exclude=“*.o” ~/proj user@host:~/backups/ 01-03-2018
  • 4.
    Gaurav Mishra <gmishx@gmail.com> Usingrsync • Performing compression on transmission ▫ rsync can compress the transmission to save bandwidth  rsync -z -r ~/project user@host:~/backups/ • Updating a backup ▫ Using update options, rsync will not transfer files which are new in the destination  rsync -av <-u/--update> ~/project user@host:~/repository/ • Deleting old files ▫ rsync support delete option which removes files from the destination which are not in the source ▫ To use this option, whole directory must be synchronized  rsync -a --delete ~/project user@host:~/repository/ 01-03-2018