Jump to content
We're Hiring! Full Stack Developer ×

Using Rsync to do backups, best practices?


je82

Recommended Posts

Hi,

 

I've setup rsync to run backup to another server in the house on a cron. I however wonder if you would add anything to this to make it more safe?

 

I run this command for example:

Quote

rsync -avu --delete --backup --backup-dir=/mnt/disk1/Deleted --suffix="_"$(date +"%Y%m%d") --stats --exclude=.Recyc -e "ssh -i /root/.ssh/NAS-rsync-key -T -o Compression=no -x" /mnt/disk9/Temp/testing/ [email protected]:/mnt/disk1/Test/ >> /home/nasbackuplogs/logs/disk11-backup-$(date +"%Y%m%d").log

With this command i do:

  • send new files to the backup destination
  • move files that have been deleted on source to /mnt/disk1/Deleted on the destination server
  • create a log file of happenings on a third server through a mounted smb share.

 

The risk i see with this is what happens if for some reason the filsystem fails and it doesn't find any files in /mnt/disk9/Temp/testing/ and it triggers it to delete / move all the files in this to /mnt/disk1/Deleted and disk1 fills up? Or if user mistakingly has deleted everything in /mnt/disk9/Temp/testing/ and the backup now deletes everything... I feel like it would be good practice to have some kind of "limiter" how many files can be deleted per session else trigger a warning and require manual intervention?

 

Any idea how to do this in scripting? Or am i going about this the complete wrong way?

 

Thanks.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...