Backup Linux Server with rsnapshot

rsnapshot is a backup software based on rsync. It can make an incremental backup. rsnapshot makes an 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 the 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

These is different 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” define the backup. These lines each parameter must be separated with TAB (space won’t work).

You can verify the configuration with the command

Test Backup

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

Here is rsnapshot -t daily result for the backup command

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

Example

NOTE: use TAB to separate each items in backup line. For arguments, use space to separate.

Running Daily Backup

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

This will run backup every day at 00:00 hours server time.

See Backup

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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