RSync
RSync copies files and can sync between servers
Backing up
RSync copies files and can sync between servers
Use RSync in [[Cronjob]]
Archive Backups with [[tar]]
TEST WITH: `--dry-run
`
rsync -aAXv --delete --exclude={/home/danicus/.cache/*} /home /mounted/backup
a= archive= its a few other tags as well
A= keeps permissions
X= keeps the next level of permissions
v= verbose
-- delete= deletes any files inside the file this will be copying to
--exclude= excludes `file/this/*, andfile/that/*`
/home= location of files you want to back up
/mounted= the backup drive location
see [[RSync#*NOTE "/"*]]
#### Multiple directories to one end location
###### use seperate command lines and run them seperately.
sudo rsync -aAXv --delete /etc /mounted/backup/wallserver/
sudo rsync -aAXv --delete /home /mounted/backup/wallserver/
sudo rsync -aAXv --delete /root /mounted/backup/wallserver/
sudo rsync -aAXv --delete /var /mounted/backup/wallserver/
sudo rsync -aAXv --delete /usr/local/bin /mounted/backup/wallserver/
sudo rsync -aAXv --delete /usr/local/sbin /mounted/backup/wallserver/
sudo rsync -aAXv --delete /srv /mounted/backup/wallserver/
sudo rsync -aAXv --delete /opt /mounted/backup/wallserver/
sudo rsync -aAXv --delete /mounted/main /mounted/backup/wallserver/
How to restore backup with RSync
https://askubuntu.com/questions/1011136/how-to-restore-backup-with-rsync
asically just revierse the order for the backup.
-tag it rsync -aAXv
Then start from backup directory and end with destination directory
sudo rsync -aAXv --delete /mounted/backups/cpbackups/ /mounted/main/directory/location/
+from Backtup= /mounted/backups/cpbackups
+To Destination= /mounted/main/directory/location?
*NOTE "/"*
The "/" means something!
At the end of the directory, if you do not include the "/" Rsync will make a directory inside the directory you specify, then will include the files in from there.
If you DO include the "/", it will drop the files/directories in, directly at the directory that you specify.
Example:
sudo rsync -aAXv --delete
((1)) /mounted/backups/cpbackups
((2)) /mounted/main/directory/location?
Without "/"
((1)) File name will be "cpbackups" and will make a directory named "cpbackups" and put it in ((2)).
With "/"
Will take files from INSIDE ((1)) and put them INSIDE the ((2)) directory.
**Change the flags**
rsync -aHAXvP /home_folder_path /backup_folder_path