Advertisement
v1ral_ITS

Rsync Full Tutorial [ linux terminal ]

Apr 3rd, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.40 KB | None | 0 0
  1. # v1ral_ITS <ImPerialTeKSolutions@outlook.com #
  2. # 2018 TM #
  3. ##################
  4. # RSYNC TUTORIAL #
  5. #      START     #
  6. ##################
  7.  
  8. Backup Your Entire Linux System Using Rsync
  9.  
  10. First, insert your backup medium (Pend drive or External hard disk). Then find the drive letter using ‘fdisk -l’ command. In my case, my Pen drive id is /dev/sdb1. Mount your drive to any location of your choice.
  11.  
  12. sudo mount /dev/sdb1 /mnt
  13.  
  14. To backup the entire system, all you have to do is open your Terminal and run the following command as root user:
  15.  
  16. sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt
  17.  
  18. This command will backup the entire / directory, excluding /dev, /proc, /sys, /tmp, /run, /mnt, /media, /lost+found directories.
  19.  
  20. Let us break down the above command and see what each argument does.
  21.  
  22.     rsync – A fast, versatile, local and remote file-copying utility
  23.     -aAXv – The files are transferred in “archive” mode, which ensures that symbolic links, devices, permissions,  ownerships, modification times, ACLs, and extended attributes are preserved.
  24.     / – Source directory
  25.     –exclude – Excludes the given directories from backup.
  26.     /mnt – It is the backup destination folder.
  27.  
  28. Please be mindful that you must exclude the destination directory, if it exists in the local system. It will avoid the an infinite loop.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement