This website uses cookies:
• from Cloudflare to identify trusted web traffic and protect this website. [read more]
• from Google Analytics to generate statistical data on how visitors uses this website. [read more]
• from Google AdSense (third party vendors, including Google) to deliver ads based on user prior visits to this website or other websites.
Do you agree that your data to be used to deliver you personalized website ads? You can change your mind at any time by accesing the ePrivacy button located at the bottom of every page. Enjoy your visit!

Ubuntu, incremental encrypted backup into the cloud

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.

timeline This article was updated, (video included) check it out here: Ubuntu, data encryption and backup, the right way

What do we need for the Ubuntu backup procedure

One 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.
mkdir {~/BackupAptik,~/BackupSync}

The aptik utility for backup of the current installed software
timeline New versions of Aptik (>18.5.2) doesn't use anymore a separate flag for the settings backup, instead it use a full home folder backup (where the software settings are also present). In order to avoid full home folder backup (the Aptik files backup it's not incremental, that's why) we need to create an "exclusion list", this being a file in our home directory named aptik-exclude (nano ~/aptik-exclude), with the following content
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.
https://mega.nz/sync

Ubuntu, incremental encrypted backup plan

The Ubuntu backup plan

Weekly backup of the installed software and their data

For 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'
allow the file to be executed
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 software

Just 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";

label_outline

Share this post on your favorite networks.
© Copyright 2017 b247.eu.org | Just another information technology blog - All Rights Reserved