Backing Up Ubuntu
Tutorial: Miscellaneous
Introduction
Backups are incredibly important; they guard against your hard drive failing, or accidentally deleting an important file. In Ubuntu (and other linux distros that use gnome) we can use the built-in Backups application to backup to a remote network share (in Linux these are managed by Samba, in Windows they're just called network shares).
IMPORTANT:
- Your computer can only perform a backup if it is on
- The backup will only work if the remote share is accessible (usually this means being connected to the same WiFi as the remote Samba server)
- The above requirement also applies to restoring
Auto Mounting the Share
First we'll make certain you can access the samba share, get Ubuntu to remember your Samba username and password, and add a bookmark to the file browser so you can view the share outside of the backup utility.
- Open the file browser (nautilus)
- Click "Other Locations" in the bottom left
- Enter the server (e.g.
smb://trichiliocosm/laptopdude
) in the "Connect to Server" box - Click "Connect"
- Choose "Connect As: Registered User"
- Enter your "Username" and "Password"
- Choose "Remember forever"
- Click "Connect"
- An entry should appear in the left pane like
laptopdude on trichiliocosm
- Right-click on it then click "Add Bookmark"
- Optional: right-click on the new bookmark and "Rename..." it
Configuring Backups
By default, Ubuntu uses a program called Déjà Dup to run backups (which itself is a graphical interface for the program duplicity). It's easy to configure, and integrates with the file browser.
WARNING: In step 17, you have the option of entering an encryption password in the "Require Password?" dialog. The advantage of encryption is that whoever owns the remote Samba Share you're backing up to won't be able to read your data (without encryption they can). The disadvantage is that if you ever forget the encryption password, it will be impossible to restore the backup.
- Open the dash (button with the ubuntu logo in the top left) and search "Backups"
- Click the safe icon that appears
- Click "Folders to save" in the left panel
- Your home folder (e.g.
Home (laptopdude)
) should already be there - Optional: use the
+
button in the bottom left to add more folders - Click "Folders to ignore" in the left panel
- Click the
+
button in the bottom left - Right click anywhere in the new file browser window and check "Show Hidden Files"
- Select
.cache
then click "Add" in the top left - If these folders are present on your system, repeat steps 8 & 9 for these:
.PlayOnLinux
.steam
.wine
Games
snap
- Click "Storage Location" in the left pane
- Choose "Storage location: Network Server" in the drop-down
- Enter the server in "Network Location" (e.g.
smb://trichiliocosm/laptopdude
) - Optional: change the destination "Folder" (e.g.
backup/laptop
) - Click "Scheduling" in the left pane
- Toggle "Automatic backup" on
- A "Require Password?" dialog should appear (see WARNING above)
- If you don't want to encrypt, choose "Allow restoring without a password"
- Optional: enable encryption
- Choose "Password-protect your backup"
- Enter a good password in the 2 boxes
- Store the password in your Password Manager
- Check "Remember password"
- Click "Forward" in the top right
- Back in the "Scheduling" section of the main "Backups" window
- Optional: change "Every" to "Day"
- Optional: change "Keep" to "At least a year"
- Click "Overview" in the left pane
- The "Back Up Now..." button should be grayed out, meaning a backup is underway
Restoring a Deleted File
- Open the file browser
- Navigate to the folder where the file used to be
- Right-click on empty space (not on a file/folder icon)
- Choose "Restore Missing Files..." to get the "Restore" dialog
- Wait for the scan to find files (this could take many minutes)
- Check the files you want to recover
- Click "Forward" in the top right
- Click "Restore" in the top right
- Wait for the restore to finish (this could take many minutes)
Restoring a Previous Version of a File
- Open the file browser
- Navigate to the file
- Right-click on the file
- Choose "Revert to Previous Version..."
- Click "Forward" in the "Restore" dialog
- Wait for the scan to find backups (this could take many minutes)
- Choose the "Date" to restore from
- Click "Forward" in the top right
- Click "Restore" in the top right
- Wait for the restore to finish (this could take many minutes)
Restoring Everything
- Open the dash (button with the ubuntu logo in the top left) and search "Backups"
- Click the safe icon that appears
- Click "Overview" in the left pane if necessary
- Click "Restore..."
- Click "Forward" in the "Restore" dialog
- Wait for the scan to find backups (this could take many minutes)
- Choose the "Date" to restore from
- Click "Forward" in the top right
- Choose "Restore files to original locations" or "Restore to a specific folder"
- Optional: choose the destination folder for the restore
- Click "Forward" in the top right
- Click "Restore" in the top right
- Wait for the restore to finish (this could take hours)
Maintenance
About once a month, the Backups utility will prompt you to test your backups. This is very important to make certain everything is working in the event you actually need to recover files. You should always test your backups when prompted to do so.
Conclusion
Your computer will now backup weekly (or daily, if you chose that) to a remote server. Most people in the tech industry will say you need 2 separate remote backups to be truly safe, but this is a great start. The Backups utility will automatically delete old backups if you start to run out of space on the remote server, so you likely won't have to worry about that either, unless you're trying to backup lots of videos or games.