Automated backups - Peter9192/MAQ_PhD GitHub Wiki
It is good practice to make regular backups of your work. There are many ways to configure (automated) backups, the way to go depends on what you want.
rsync
command
Simple backups using the More advanced backups using Freefilesync
Freefilesync is one of the many backup tools that are freely available online. It is a piece of software that you need to install, but it is lightweight, intuitive and available for all platforms. This tool give you the opportunity to configure your backup settings. For example, where rsync just copies your files from one location to another, Freefilesync gives you the opportunity to synchronise two folders, keep older versions, and so on. The differnce between backup and synchronisation is that with the latter files can be copied from "left to right" or from "right to left", depending on the rules you choose. Default behaviour is "newest replaces older file". The program will keep an index of the files that are synchronised, so it is also able to identify deleted items. This is useful, but at the same time a bit tricky and you should be careful with this. Luckily, you can set a rule for what to do with deleted items. In my case they will be moved to a dedicated trash folder on my backup disk. The advantage of synchronisation over backup, for me, is that it allows me to take my external hard drive home, make changes there, and when I plug it back in, all my folders will sync with my local working directories at the office.
Automating your backups
Some of the software tools have special settings for backup scheduling, but on Linux you might consider using crontab instead. You can access crontab by opening a terminal window and typing crontab -e
. A configuration file will open, and all you have to do is add your tasks in the following format:
MM HH D M D <your command>
Here MM is minute, HH is hour, the first D is day of month, M is month and the last D is day of week. You can replace every one of these time indices with an asterix * for "every". For more info on crontab, just google it. A crontab for rsync can be as simple as
30 12 * * * rsync ...
So the rsync
command will be executed every day at 12:30 local time.
For freefilesync there is a tool available (seperate piece of software) that helps you schedule your backups, but I didn't get that to work the first time. Luckily, it is also possible to start freefilesync from the crontab. All you have to do is -- once you've configured a backup/synchronisation -- save your configuration as a batch job. Then, you can run your backup in crontab with (in my case):
DISPLAY=:0.0
30 12 * * * /usr/bin/FreeFileSync /media/peter/Elements/00_Sync/SyncSettings.ffs_batch
The first line is somehow necessary for this to work. Just copy it. The second command would translate to "Open Freefilesync which is located in /usr/bin and run SyncSettings.ffs_batch located in ...." In my case, I have made a separate folder on my backup drive called 00_Sync which contains the backup configuration file, the trash folder, and also I configured Freefilesync to make a log file every time it backups, so I can check that it has run.
Thats it!