Samstag, 9. Juni 2018

How I backup my Synology NAS using rsync

I might be a bit oldfashioned, but I prefer to use my onw backup solution on my NAS rather than relying on a tool by the supplier. I use two external Harddrives, which I exchange in intervals. To backup my content on it, I use good old rsync. Note that for this approach to work, you should turn on the "User-Home-Service", otherwise, there is no home directory for admin. To install the script, ssh to the NAS with the admin user: ssh admin@yoursyno.domain Then change to root using sudo -i. The backupscript is simple. Note that it just creates an archive on the disk. Since my target disk currently is on NTFS, I use raw rsync. At a later stage, I will change to rsnapshot. (Which requires you to install perl on the NAS first.) Without further ado, here is my script:

I added this in /etc/crontab to start the backup daily. Note how I use the flock command to ensure that only a single instance of the backup is running. It is important to put the lockfile in a location other than /tmp.

Finally, I need to make sure that the logs do not overflow. To that end, I created this file in /etc/logrotate.d

Keine Kommentare:

Kommentar veröffentlichen