This post is abut setup rsnapshot in your ubuntu. Please adjust the configuration per your needs.
- Install rsnapshot:
sudo apt-get update
sudo apt-get install rsnapshot
- Create a configuration file for rsnapshot:
sudo cp /etc/rsnapshot.conf /etc/rsnapshot.conf.bak
sudo nano /etc/rsnapshot.conf
- Set the following variables in the configuration file:
config_version 1.2
snapshot_root /mnt/backup
no_create_root 1
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger /usr/bin/logger
retain daily 7
retain weekly 4
retain monthly 6
- Set up a cron job to run rsnapshot at a specific time.
To edit the crontab file, run:
crontab -e
Add the following line at the bottom of the file to run rsnapshot every day at 3:00 AM:
0 3 * * * rsnapshot daily
- Save and close the crontab file.
- Test the configuration by manually running rsnapshot:
rsnapshot daily
This will create a snapshot of your system in the snapshot_root
directory specified in the configuration file.
You can now set up rsnapshot to run automatically on a schedule, according to your backup needs.