Back Up Your System

Back Up Your System

Use Ubuntu's Simple Backup utility to easily set up standalone or recurring backups of your important files.

Backups always seem to be the thing we think about after it's too late. Just about every computer user we know has been bitten at least once by failing to make a backup of an important file or directory. Yet what should you back up? How often? Out of the hundreds of backup tools out there, which should you use? Ubuntu has answered all of these questions with the aptly named Simple Backup tool. This tool allows you to schedule automatic recurring backups of predefined important files on the system, or, if you want more control, it allows you to set fine-grained backup options that better suit your needs. In this hack, we discuss some of the main options in the Simple Backup tool and how to set up a backup-and-restore solution for your computer.

Get Simple Backup

The first step is to install Simple Backup. Its package is called sbackup and is available from the universe repository, so if you haven't yet enabled universe, you will need to do so. If you need more instructions on how to enable repositories, refer to "Modify the List of Package Repositories" [Hack #60] or the individual hacks corresponding to your preferred package-management tool [Hacks #54, #55, and #56].

Once the program is installed, two new menu entries will appear under SystemFigure.

The main Backup Properties window

Configure Simple Backup

The General tab displays three main options for you to choose from:

Use recommended backup settings

If you are new to Ubuntu or aren't quite sure what you should back up, but you do want to set up recurring backups, select this option. It will automatically set up daily incremental and weekly full backups of important directories on your system and store them under /var/backup. Note, however, to prevent the backup from filling up your disk, this option excludes files larger than 100 MB as well as a number of multimedia files, so if you want to back up either of those, move to the next options.

Use custom backup settings

If you have specific backup needs, or the default choices from the recommended backup don't suit you, choose this option to access the fine-grained configuration options in the following tabs (more on them shortly).

Manual backups only

If you don't want to set up a recurring backup schedule, but you do want to be able to manually back up some files from time to time, select this option and read on for more information on how to configure what to back up in the following tabs.

Use recommended backup settings

If you are new to Ubuntu, don't know what exactly to back up, or don't want to fuss with a configuration, check "Use recommended backup settings" in the General tab and then click Save. Ubuntu will schedule a nightly incremental backup of important files on the system, along with a weekly full backup. If you later find you need to restore a file, see the "Restore from Backup" section later in this hack.

Use custom backup settings

There are a number of reasons why the default backup settings might not suit you. For instance:

  • You may have a number of important files that are larger than 100 MB, and you need to be able to back those up.

  • You want to keep a backup of your multimedia files.

  • You want to save the backups somewhere other than /var/backup (either another directory on the system or possibly a directory on a remote system).

  • You want to include or exclude other files or directories from the backup.

  • You want to schedule your backups to run at different times or different frequencies from the default.

If you want to enable custom recurring backups, select "Use custom backup settings." If you want to configure a custom manual backup instead, select "Manual backups only." Apart from the Time tab being disabled in the manual backup option, the configuration ability will be identical.

Configuring Custom Backup Settings

Here are some settings you can modify to customize the backup of your system.

Configure files to include

By default, Ubuntu includes the major important directories you might want to back up on a system, such as /etc, /var, /home, and /usr/local. It's possible you might have an extra directory or file that you want included in addition to these (possibly an extra mount point under /mnt). If so, click the Include tab to see the directories and files currently included in the backup (Figure).

Define which directories to include in the backup

Configure files to exclude

There are a number of different files that Simple Backup excludes by default. Click the Exclude tab to configure these exclusion options. Figure shows an example of some multimedia file types that are excluded by default. If you do want to back up your MP3s for instance, select "mp3" from the list of excluded files and click Remove. If you want to add a particular file type to the exclusion list, click the Add button and choose a predefined file type from the drop-down menu, or enter the file's extension and then click OK. This particular exclusion list depends on actual filename extensions, so it will work only on files with the correct extensions in their filenames.

Define which file types to exclude

A number of different exclusion properties are allowed via the tabs along the left side of the window. In addition to file types, click Paths to exclude by individual files or directory paths. If you are familiar with defining patterns using regular expressions, click the Regex tab and you will be able to define an exact pattern to match files to exclude. The final tab in this window, "Max size," is important because it will greatly influence the size of your backups. If you choose the custom configuration, it will default to excluding files larger than 10 MB. Depending on the size of the files you want to back up, you may want to raise or completely disable this option, but note that in doing so you risk filling up your backup directory if it doesn't have adequate space.

Configure the backup destination

The Destination tab allows you to change where Simple Backup will store backups. You can select the default of /var/backup, choose a custom directory somewhere on your system, or even select a remote FTP or SSH share. To back up to a remote share, use the "Connect to Server" dialog shown in Figure or type ssh:// or ftp:// followed by the username:password, then @, then the remote host to connect to and the remote directory.

Back up to a remote share

Configure recurring backups

If you want to have Simple Backup automatically back up your system periodically, click the Time tab to configure how frequently to back up (Figure). You can choose anything from never backing up to backing up hourly, daily, weekly, or monthly. You can also configure the time, day of week, or day of month to back up, depending on how frequently you want to back up the system. Finally, you can configure how often to do a full backup. By default, a full backup is performed weekly, with incremental backups being performed otherwise to save space.

Schedule your backups in the Time tab

When you are finished with your backup configuration, click Save to save the configuration and exit, or click Backup Now to start the backup right this instant based on your configuration.

The "Restore files/directories" window

Restore from Backup

So you have accidentally deleted a file, or you need to roll back to a previous version of it. If you have already configured recurring backups, or have manually performed backups using Simple Backup, click SystemSimple Backup Restore. Figure shows the main window with a particular backup set selected. You can choose from any previous backups from the "Available backups" drop-down menu, and you can then browse through the directory structure of the backup to find the file or directories you want to restore. Once you have found the files or directories you want to restore, click Restore to overwrite any current version of the file with the backed-up version, or click Restore As to restore the file or directory to a new location with a new name so you don't overwrite the current version.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows