Backup your data

If they aren't already, regular backups should be a part of your routine. The fact is that computers are fallible and hard disks break. Humans are also fallible and tired minds mean we don't always watch what we type or click.

Backup is one task that Linux is particularly good at and a wealth of command-line tools are available. For this tip we're going to look at a GUI tool called Simple Backup, which automates the procedure of backup but uses the traditional backup tools. It produces the standard Linux backup filetype: compressed tar archives.

But what kind of data should you backup? Data on your system falls into three broad categories: program data, configuration data, and personal data. It's reasoned that backing up all three is inefficient, because that would mean backing up the entire hard disk. Even if you have the storage capacity, this simply takes too long. Therefore people usually back up configuration and personal data. If a disaster strikes, the operating system can be reinstalled from CD and, once the configuration files are restored from the backup, it should work just like it did.

Part of the technique of backing-up is to copy the backup archives you create to a secure location. Backup files should certainly be copied off the hard disk that contains the original data as soon as possible after creation. Good choices for safe storage of the backup onto are rewritable DVD discs, or a separate hard disk that connects via a USB connection. Some higher-capacity USB memory sticks can also be used.

To install Simple Backup, use Synaptic to search for and install sbackup. Once installed, two new entries will be found on the System ^ Administration menu: Simple Backup Config, and Simple Backup Restore. As na j&g&jp Pf ¡¿pâlîtes-

General Include Exclude Destination Time Purging

Use recommended backup settings;

Do standard backups.

Defaults: daily incremental and weekly full backup to /var/backup of all user files, /etc, /usr/local and /var.

Multimedia files, temporary files and files larger than 100 Mb are excluded.

Q Use custom backup settings

Do backups according to the settings defined on the next pages of this dialog.

Manual backups only

Do not backup your data automatically Note:

this does not prevent doing manual backups.

Manual backups only

Do not backup your data automatically Note:

this does not prevent doing manual backups.

■^jf About

r^Backup Now!

□ save

|fj| Close

Figure 3.51: Simple Backup Configuration (see Tip 286, on the preceding page)

you might expect, Simple Backup Config is used to create or amend the backup job, while Simple Backup Restore is used after the disaster has occurred to restore the files.

Creating and scheduling a backup job

Start by clicking System ^ Administration ^ Simple Backup Config. In the program window that appears, you'll have three choices: Use recommended backup settings, Use custom backup settings, and Manual backups only. See Figure 3.51 for an example.

Automated backups

The first option configures Ubuntu to run an automated backup job every day, in the background and shortly after the computer has booted for the first time. Vital configuration files along with all the data within users' /home folders are backed-up, although audio and video files as well as any file over 100MB are ignored to avoid the backup archive becoming too large.

Once an initial backup has been taken, the daily backup pass creates incremental backups, meaning that only altered files are backed-up. This makes all subsequent backup passes much faster.

If all of this sounds like what you want then select the Use recommended backup settings option and click the Save button. Then click the Backup Now! button to create the first backup. And that's all you need do. You can immediately close the Simple Backup window because the actual backup job runs entirely in the background. The downside of this is that you have no progress display but, generally speaking, it's best to wait about an hour for the backup to complete. You can check on the backup job from the command line by typing the following: $ ps aux|grep tar

This checks for the tar archiving program amongst the currently running processes. Look for the command in the output—it will probably run across several lines and begin tar -czS -c / -no-recursion If the command is not listed in the output (ignore grep tar in the output), then the command has finished.

The backup folder containing the actual backup archive and necessary directory files will be placed in the /var/backup folder (not/var/backups!). It will have a .ful extension. You can copy this folder to wherever you wish (for example, a DVD-RW disc, depending on size).

Subsequent incremental and much smaller backup folders will be saved to the same location every day (these will have .inc extensions), although every seven days a completely new backup will be taken, which will result in a new main backup .ful folder. Old backup files are automatically deleted after 30 days. Each backup file is named after the day's date. Note that you should copy the incremental backup files to your chosen storage media along with the main backup file—incremental files are useless without the main backup file.

Configuring backup jobs

If you want to tweak the backup job, click the Use custom backup settings button. Then click the tabs to change the options. The backup is entirely configurable but here are some particular options you might like to change:

• Backup all types and sizes of file: If you intend to store the eventual backup archives on an external hard disk, there's no reason why you shouldn't backup all the files in your /home folder, including multimedia files, which tend to make the eventual backup archive very large. To allow this to happen, click the Exclude tab, click the Max Size sub-tab on the left of the program window and remove the check alongside Do not backup files bigger than [[Author:

sic]] . Additionally, click the File Types sub-tab and remove all the entries in the list by highlighting them and clicking the Remove button.

• Changing the backup file location: By default the backup files are saved to /var/backup (not/var/backups!) but you might choose to save them direct to an external hard disk or a network share. To do this, click the Destination tab and select Use custom local backup directory. Then click the file browse dropdown and select the location.

• Changing the backup time: By default the backup will occur each day shortly after your computer has booted for the first time. To change it so that the backup occurs hourly, weekly, or monthly, click the Time tab and select the relevant option from the Do Backups dropdown list. To set a specific time when the backup should occur—maybe 1.30pm while you're at lunch, for example—click the Precisely button and set the time in the Hour and Minute boxes. If you select Weekly or Monthly in the Do Backups dropdown list, you'll also be able to select from the Day of month or Day of week lists.

Once done, click the Save button and then the Backup Now button to create the initial backup.

Restoring a backup

If the worst happens and you need to restore any number of files from the backup, click System ^ Administration ^ Simple Backup Restore. If the very worst happens and you had to reinstall Ubuntu from scratch then ensure you recreate the exact same username for yourself—this will avoid problems with file ownerships and restored file locations. Then follow these steps to restore the data:

1. The first step is to select the location of the backup archives. Select the Use Custom radio button and click the folder icon to open a file browse dialog so you can navigate to where the backup is stored. It's important not to specify the backup folder itself— just the folder that it's in. For example, if the backup folder was stored on your desktop, you should enter /home/username/desktop as the location (replacing username with your username). Once done, click the Apply button. This will cause Simple Backup to scan the archives.

Figure 3.52: Simple Backup Restore (see Tip 286, on page 332)

2. Click the Available Backups drop-down list to choose a backup from which to restore—they are sorted by the dates they were made.

3. Once the backup has been selected, the files that the backup archive contains will be displayed below the Files and Folders to restore heading, as shown in Figure 3.52. Each folder will have a small triangle to its left, which you can click to expand the folder and show its contents.

4. After you've found the file(s) or folders you want to restore, highlight them, and then click the Restore button. To restore system configuration settings, you should select to restore /etc, /usr and /var. Beware: this will rewrite the files and folders to their original locations. Files or folders already there with matching filenames will be overwritten! If you want to restore any files to a different location, click the Restore As button, and then choose a folder.

Use the Ubuntu install CD as a general-purpose partitioning tool M 337

Was this article helpful?

0 0

Post a comment