Backup Your Linux Remotely Using Rsync Command

Rsync Is A Command In Linux Which Stands For Remote Sync. It Is Used For Backing Up The Data. It Synchronizes The Directories And Files From One Location To Another In A Good Way. The Backup Destination Could Be Either On Local Or On Remote Server.$ Rsync -Avz Chankey@192.168.200.10:/Var/Lib/Rpm /Root/Temp
Case 6: Select Remote Shell
$ Rsync -Avz -E Ssh Chankey@192.168.200.10:/Var/Lib/Rpm /Root/Temp
rsync -e ssh => uses the ssh shell for remote sync
Case 7: Do Not Overwrite Modified File At Destination
If the file at the destination is modified and if we don’t want to change it back to the old one again then using rsync -u option.
$ Rsync -Avzu Chankey@192.168.200.10:/Var/Lib/Rpm /Root/Temp
Case 8: Synchronize Only The Directory Tree Structure (Not Files)
use rsync -d option for this purpose.
$ Rsync -V -D Chankey@192.168.200.10:/Var/Lib/ .
Case 9: Do Not Create New File At Destination, Just Update Existing Files
use –existing option
$ Rsync -Avz --Existing Root@192.168.1.2:/Var/Lib/Rpm/ .
Case 10: Transfer The Entire File
use rsync -W option
#  Rsync -AvzW  Chankey@192.168.200.10:/Var/Lib/Rpm/ /Root/Temp
Features:
  • Speed: Rsync Replicates All The Data From Source To Destination And Then It Transferes Only The Changed Blocks/Bytes To The Destination. This Makes The Transfer Fast.
  • Security: It Uses Encryption Using Ssh Technique.
  • Bandwidth: It Compresses The Block At Source And Then At The Receiving End It Decompresses The Block. It Transfers The Data Block By Block Using Compression And Decompression At Source And Destination Side Respectively. Hence Uses Less Bandwidth.
  • Privileges: No Extra Privileges Are Required To Use Rsync.
Syntax
$ Rsync Options Source Destination
Case 1: Synchronize Two Directories In Local Server
use rsync -zvr command (z to enable compression, v for verbose, r for recursive)
$ Rsync -Zvr /Var/Opt/Installation/Inventory/ /Root/Temp
The above command does not preserves the timestamp.
Case 2: Preserve Timestamps Using Rsync -A
The -a options preserves symbolic links, permissions, timestamp, owner and group.
$ Rsync -Azv /Var/Opt/Installation/Inventory/ /Root/Temp/
Case 3: Synchronize Only A Single File
Specify the file name to the rsync command
$ Rsync -V /Var/Lib/Rpm/Pubkeys /Root/Temp/
Case 4: Synchronize Files Local->Remote
$ Rsync -Avz /Root/Temp/ Chankey@192.168.200.10:/Home/Chankey/Temp/
Case 5: Synchronize Files Remote->Local
$ Rsync -Avz Chankey@192.168.200.10:/Var/Lib/Rpm /Root/Temp
Case 6: Select Remote Shell
$ Rsync -Avz -E Ssh Chankey@192.168.200.10:/Var/Lib/Rpm /Root/Temp
rsync -e ssh => uses the ssh shell for remote sync
Case 7: Do Not Overwrite Modified File At Destination
If the file at the destination is modified and if we don’t want to change it back to the old one again then using rsync -u option.
$ Rsync -Avzu Chankey@192.168.200.10:/Var/Lib/Rpm /Root/Temp
Case 8: Synchronize Only The Directory Tree Structure (Not Files)
use rsync -d option for this purpose.
$ Rsync -V -D Chankey@192.168.200.10:/Var/Lib/ .
Case 9: Do Not Create New File At Destination, Just Update Existing Files
use –existing option
$ Rsync -Avz --Existing Root@192.168.1.2:/Var/Lib/Rpm/ .
Case 10: Transfer The Entire File
use rsync -W option
#  Rsync -AvzW  Chankey@192.168.200.10:/Var/Lib/Rpm/ /Root/Temp


Category Article

What's on Your Mind...

Powered by Blogger.