Stardust

How to backup your Linux system

This guide was made using CentOS 7 with cPanel.

  1. If you want a local backup:

rsync -arAXrv --delete --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found} /* /destination

  • -a = all files
  • -A = all properties
  • -X = extended permissions
  • –delete = delete anything in the destination
  • –exclude = adivina… exclude the folders in the brackets.
  • -r = recursive

  1. To restore a local backup:

rsync -arAXvz --delete /backupfolder /source

  • -z to compress the data. This is useful for backups over the network.

  1. Backups over the network:

rsync -arAXzv source/ root@IP/Domain:/home/

  1. Connecting to a non-default port:

rsync -arAXzv -e 'ssh -p 404' --progress --delete tecmint@192.168.1.103:/backup1 /home/sk/backup2

  • -e = remote shell
  • -p = port

  1. Manual backup and restoration process in cPanel 

  2. If you want to do a dry-run:

rsync --dry-run BACKUP_OPTIONS

Leave a Reply

Your email address will not be published. Required fields are marked *