Local Backup
You can never know when a hard drive will fail or a software update will cause your operating system to fail to boot. It's always best to be prepared and build yourself a safety net. A simple yet effective backup solution is simply an external hard drive connected to your server.
Timeshift is an application that runs in the background on your server and performs backups to a local storage drive. This service only copies files as they change, making it easy to perform incremental backups daily or weekly. These can be created on a schedule and old backups being automatically deleted to free up space as needed. In the event of a storage drive failure, we can use the command line version of Timeshift to restore our system from the latest backup.
We can install Timeshift using the terminal:
sudo apt-get install -y timeshift
Once installed, we can open it with:
sudo timeshift-gtk
While connecting through RDP, this terminal command temporarily allows the root user's GUI applications to launch through your user account:
xhost si:localuser:root
The first time we open Timeshift, it'll start a configuration wizard.
We will be asked what Snapshot style we want to use for our backups and select 'rsync'. Rsync is open-source command-line application that specializes with incremental file transfers.
Timeshift will estimate the backup size by scanning our system files. This should not take long because we are setting up a brand new operating system.
Once it's completed, we'll be asked where we will be storing our backups. We will select the Storage drive that we mounted earlier. Timeshift will create a folder within the root of that drive, in our case: /mnt/storage/Timeshift.
Next, we'll have choose our snapshot level. This allows us to customize how often we want our backups to run, as well as how many to keep. Weekly backups are a great starting point, but running them nightly can help you get back up and running faster. Enabling monthly, weekly, and daily backups will provide the most protection by ensuring you have received data going back months.
Timeshift will ask if you want to backup the home directories for root and your account system accounts. We will choose to enable both to include all files.
Now that we have finished setup, we can create our first backup by hitting the vertical_align_bottom 'Create' button.
A window will appear to show us the current progress. The first backup of your freshly installed operating system shouldn't take too long.
Once the backup is completed, you're safe in the event of a backup.
Timeshift will automatically backup your computer on the schedule we selected. Your system and files can be restored through the graphical interface, on your current system or through a Debian Live CD.