You are not logged in.
Pages: 1
I was thinking of installing rsnapshot to do some weekly & monthly backups. Assuming it will keep the last backups for a 3 month interval after the weekly backup. This is my first time trying rsnapshot. How do I define the backup to run, lets say every Tues. at 23:00 (11:00pm)?
I was following this Archlinux guide on configuring it.
https://wiki.archlinux.org/index.php/Rsnapshot
I want a weekly backup. This is how I have it setup in my rsnapshot config file.
#retain hourly 6
#retain daily 7
retain weekly 4
retain monthly 3
I want it to backup weekly (Tues. 23:00). Does the "retain monthly 3" keep the past 3 months once completed for 3 months?
Again, how do I define the day of the week to start the backup? It will use systemd to run it as a service.
Thnx.
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
Silly me, I need to setup a cron job...
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
I still haven't gotten this working. Back to the drawing board.
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
Hi ghostdawg, I don't use this usually, but I will have a look and see if I can get it working to help you. Could you post what you set as your cron entry and I will try and help with debugging
Offline
First test completed and it works ok from the command line (as root) but when running from a cron job it fails with insufficient permissions. So you will have to set up a cron job as root for it to work. If you have any further issues let me know and I will look again.
Offline
I just ran "rsnapshot -v weekly" in a terminal and it seems to run but I do not see the backup it should have created. Looking at the target folder, it's not there.
$ sudo rsnapshot -v weekly
[sudo] password for saptech:
echo 9834 > /var/run/rsnapshot.pid
/bin/rm -rf /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.3/
mv /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.2/ \
/media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.3/
mv /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.1/ \
/media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.2/
/bin/cp -al /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0 \
/media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.1
/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded /home \
/media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/localhost/
/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded /etc \
/media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/localhost/
/usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded \
/usr/local /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/localhost/
touch /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/
rm -f /var/run/rsnapshot.pid
Following the wiki it said to run crontab from rsnapshot cron, but I'll try the original crontab command.
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
You do realise that it always creates weekly.0 and renames the previous runs with increasing numbers to the maximum set by the config file don't you? So if you look at the timestamps of the directories (weekly.0, weekly.1 etc) it should tdll you when it was run. Also if you have enabled logging you should check /var/log/rsnapshot.log which will also say what operation succeded/failed.
Offline
One thing that might be worth noting here is that if you use a soft-linked directory as the source folder it will simply copy the soft-link to the storage directory, so any file changes are not saved.
I use soft-links in my home directory to link to folders on my "data" partition so I share access with other distro's ( i multi-boot a lot ) each distro has a soft-link to Documents,Downloads,Pictures,Videos etc in it's home folder and I remove the default directories.
I guess I would have to use the actual directory on my "data" partition to maintain a snapshot of it, but that didn't seem obvious to me when I set it up.
Offline
You do realise that it always creates weekly.0 and renames the previous runs with increasing numbers to the maximum set by the config file don't you? So if you look at the timestamps of the directories (weekly.0, weekly.1 etc) it should tdll you when it was run. Also if you have enabled logging you should check /var/log/rsnapshot.log which will also say what operation succeded/failed.
That's just it, it is not creating the new set (weekly.1) and weekly.0 was ran manually on Oct. 1. Viewing the directory after running rsnapshot show the date as 10.01.16, I assume it's not creating a new set.
I'm not using a soft-linked directory as the source folder. I have the full path to the source folder.
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
Did you enable logging? and if so what does the logfile contain?
This was my last run of testing (from the logfile)
[15/Oct/2016:17:52:01] /usr/bin/rsnapshot hourly: started
[15/Oct/2016:17:52:01] echo 27299 > /var/run/rsnapshot.pid
[15/Oct/2016:17:52:01] /bin/rm -rf /media/dai/LinuxData/BACKUPS/hourly.5/
[15/Oct/2016:17:52:01] mv /media/dai/LinuxData/BACKUPS/hourly.4/ /media/dai/LinuxData/BACKUPS/hourly.5/
[15/Oct/2016:17:52:01] mv /media/dai/LinuxData/BACKUPS/hourly.3/ /media/dai/LinuxData/BACKUPS/hourly.4/
[15/Oct/2016:17:52:01] mv /media/dai/LinuxData/BACKUPS/hourly.2/ /media/dai/LinuxData/BACKUPS/hourly.3/
[15/Oct/2016:17:52:01] mv /media/dai/LinuxData/BACKUPS/hourly.1/ /media/dai/LinuxData/BACKUPS/hourly.2/
[15/Oct/2016:17:52:01] /bin/cp -al /media/dai/LinuxData/BACKUPS/hourly.0 /media/dai/LinuxData/BACKUPS/hourly.1
[15/Oct/2016:17:52:01] /usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded /home/dai/PycharmProjects /media/dai/LinuxData/BACKUPS/hourly.0/localhost/
[15/Oct/2016:17:52:01] touch /media/dai/LinuxData/BACKUPS/hourly.0/
[15/Oct/2016:17:52:01] rm -f /var/run/rsnapshot.pid
[15/Oct/2016:17:52:01] /usr/bin/rsnapshot hourly: completed successfully
As you can see it has removed the highest numbered folder (hourly.5) and moved the other folders (1->2, 2->3, etc), then copied folder 0 to folder 1, then performed rsync on folder 0 to update any changes, then it touches the folder to give the current timestamp, removes the pid file info and reports success.
This looks the same as your post earlier from when you performed the snapshot from the command line.
My directory listing (ls -l) from the backup folder is
drwxr-xr-x 3 root root 4096 Oct 15 17:52 hourly.0
drwxr-xr-x 3 root root 4096 Oct 15 16:52 hourly.1
drwxr-xr-x 3 root root 4096 Oct 15 15:52 hourly.2
drwxr-xr-x 3 root root 4096 Oct 15 14:52 hourly.3
drwxr-xr-x 3 root root 4096 Oct 15 13:52 hourly.4
drwxr-xr-x 3 root root 4096 Oct 15 12:52 hourly.5
And as you can see the times are all in order, and I used hourly to be able to leave it running for testing, and so far it all ran fine.
1. Did you put the cron job into the root crontab?
2. Or are you running it as a system service?
And the soft-link stuff was just for info really, I just happened to notice it
Offline
It looks like it's working but I have no idea where it putting them.
15/Oct/2016:07:39:46] /usr/bin/rsnapshot -v weekly: started
[15/Oct/2016:07:39:46] echo 9834 > /var/run/rsnapshot.pid
[15/Oct/2016:07:39:46] /bin/rm -rf /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.3/
[15/Oct/2016:07:39:49] mv /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.2/ /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.3/
[15/Oct/2016:07:39:49] mv /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.1/ /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.2/
[15/Oct/2016:07:39:49] /bin/cp -al /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0 /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.1
[15/Oct/2016:07:39:50] /usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded /home /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/localhost/
[15/Oct/2016:07:40:59] /usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded /etc /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/localhost/
[15/Oct/2016:07:41:00] /usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded /usr/local /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/localhost/
[15/Oct/2016:07:41:00] touch /media/saptech/6B82A265151273E7/Q4OS-Bkup/weekly.0/
[15/Oct/2016:07:41:00] rm -f /var/run/rsnapshot.pid
[15/Oct/2016:07:41:00] /usr/bin/rsnapshot -v weekly: completed successfully
$ ls -l /media/saptech/6B82A265151273E71/Q4OS-Bkup
total 5480040
-rw------- 1 saptech saptech 2139192161 Sep 19 18:04 Q4os-091916.fsa
-rw------- 1 saptech saptech 3472363605 Oct 3 15:57 Q4os-100316.fsa
drwx------ 1 saptech saptech 0 Oct 1 22:49 weekly.0
Maybe the target directory is on an ext. hdd formatted as NTFS. Oct 1, when I manually ran it the first time does have files in it. All folders are showing the Oct 1 date.
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
It looks like the snapshot was taken, do you have any files in your weekly.0 folder?
Offline
Yes, files are in the folder from Oct. 1 date. I'm going to run the cronjob as root and see what happens. Thanks for helping with this.
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
You're welcome, I think I will find a use for rsnapshot myself now as it seems to do quite a good job and is very configurable.
And if I could make a suggestion, you might want to use hourly while you are getting it set-up as it will make it easier to trace what is happening when it is running on it's own.
Offline
That's a good idea to run daily to see how it works. This is what I'm going to add to root's crontab:
0 3 * * 2 root /usr/bin/rsnapshot weekly
Dell Optiplex 760 - Quad Core | 4gb | 250gb | Mageia 5, Salix 14.2, Q4OS
Lenovo Thinkpad T420 | 4gb | 120gb | Mageia 5, Debian Testing
Offline
Pages: 1