Why do we need backup should not be a question, but this is a quick answer for my situation:
- I need to easily revert to a previous version of my files or software settings
- I need to easily restore a deleted file or folder
- I need to easily restore all of my personal files and software settings in case of a SSD failure, OS re-installation or a complete system crash.
- I need that the backup plan to run automatically
Also, for the worse case scenario, I need a cloud storage where to keep the backup, encrypted in a format accessible only for me, so no one by me can access this data without proper authorisation.
What do we need for the Ubuntu backup procedureOne folder to store the installed software settings data. I’m using ~/BackupAptik for this
One folder to store a local backup. I’m using ~/BackupSync for this. BackupSync will be also synced into the cloud.
The aptik utility for backup of the current installed software
BackupAptik BackupSync Desktop Downloads Documents Videos Music Pictures
sudo apt-add-repository -y ppa:teejee2008/ppa sudo apt update sudo apt install aptik sudo apt install aptik-gtk # if your sudo aptik --version is greater or equal than 18.5.2
The deja-dup utility for incremental encrypted backup.
sudo apt install deja-dup
The MegaSync utility from mega.nz for cloud storage access and sync feature.
|Ubuntu, incremental encrypted backup plan|
The Ubuntu backup plan
Weekly backup of the installed software and their dataFor this we will gone use the aptik utility and setup a cronjob for a weekly recurrence.
Ceate a file named aptik inside the /etc/cron.weekly/ directory. If you need another standard recurrence, create the file into the cron.daily or cron.monthly directory. You can also subsequent move this file afterwards.
sudo apt install cron anacron sudo nano /etc/cron.weekly/aptik
with the following content, accordingly adjust the home folder paths
#!/bin/sh # # aptik backup aptik \ --backup-all \ --basepath '/home/catalin/BackupAptik' \ --skip-cache \ --include-pkg-foreign \ --exclude-from '/home/catalin/aptik-exclude'
sudo chmod +x /etc/cron.weekly/aptik
You may test the cron execution by issuing the following command, this also will create the initial software and settings backup
sudo run-parts --report /etc/cron.weekly
Daily incremental encrypted backup of personal data and softwareJust lunch the deja-dup utility, set “Storage location” to local folder BackupSync and add ~/Documents, ~/BackupAptik to the “Folders to save”. Enable “Automatic backup”, Every Day scheduling and then do a “Back Up Now” action into the overview section. You will be asked for a password, enter a strong one and check remember password. That’s it, from now one you will have daily incremental encrypted backups of your documents and, once a week, new programs data added to the backup.
|Deja Dup Pop!OS Ubuntu 17|
Cloud sync of the backup data
So right now we have an incremental encrypted backup locally
stored. One last step to cover us completely is to keep our local
BackupSync folder in sync with a cloud folder.
For this, just lunch the MegaSync client and setup one sync location between local BackupSync folder and a cloud folder of choice.
The MegaSync client will take care to synchronize your local backup folder to the cloud every time new content is added to the backup. And, more than that, if something goes wrong with the local folder backup, don’t worry, mega.nz will keep (in trash) all the deleted/modified files.
|MegaSync Pop!OS Ubuntu 17|
Now, for the recovery part, you have:
The Deja Dup GUI - full restore for files (either to their original location or to a location of choice)
Gnome Files - individual file/folder restore, missing files/folders restore (right click on file/directory or inside directory)
The Aptik GUI for software restore
For the worst case scenario, I have encountered this, my Intel SSD suddenly died, I have managed to restore my precious data and software settings. In that case, the restore procedure is as follows: 1. recreate the BackupSync and BackupAptik storage folders; 2. install the MegaSync client from mega.nz, config the sync path between cloud storage and local computer (as in this tutorial) then allow it to get the data back; 3. reconfig the deja-dup utility (as in this tutorial) and then use the restore function to restore the backup-ed data to their original location; 4. Install the aptik utility, select the corect path to BackupAptik folder then click "one click restore";
Ubuntu, data encryption and backup, the right way
Restic & incron/inotify, continuous backup on folder content change