Backup Linux Server with rsnapshot

rsnapshot is a backup software based on rsync. It can make incremental backup. rsnapshot make automatic incremental backup using rsync and cronjob. It use linux hardlinks to save disk space. When you make the first backup, all files are copied to the backup location, every subsequent backup  makes a copy of previous backup using linux hard links, then copy over new and changed  files, delete files that are removed from the source folder. This way even if you have multiple copies of the files, there is only one file stored in your disk. rsnapshot is available for installation from apt repositories in Ubuntu and Debian Linux.

https://rsnapshot.org/ (GitHub)

To install rsnapshot on Ubuntu/Debian, run

Configure rsnapshot

rsnapshot configuration file available in /etc/rsnapshot.conf, you need to edit this file to configure rsnapshot.

To change the location of backup folder, change

I change this to /backup/

Below you will find

This is differnt backup rotations, to easily understand, i renamed it as daily/weekly/monthly

This will store 6 daily backups, 3 weekly backups and 3 monthly backups.

Uncomment following lines

The lines starting with “backup” defines the backup. These lines each parameters must be seperated with TAB (space won’t work).

You can verify the configuration with command

Test Backup

To see the commands used by rsnapshot to take backup, run

Here is rsnapshot -t daily result for backup command

To exclude a folder from backup, you can use +rsync_long_args=–exclude=/full/path/to/folder

Example

NOTE: use space to seperate parameters in backup line.

Running Daily Backup

To run daily automated backup, you need to set a cronjob

This will run backup everyday at 00:00 hours server time.

See Backup

Leave a Reply

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