Debianhelp.co.uk


Backup Basics

Why backup?

Backups are needed in case a file or a group of files is lost. The reasons for losing files include

Hardware failure like disk breaking,
accidentally deleting wrong file and
computer being stolen.

Backups help in all the above situations. In addition, it may be good to have access to older versions of files, for example a configuration file worked a week ago, but since then it has been changed and nobody remembers how, its just not working anymore.

There are other solutions, and they are good to have if you can afford them. These include

redundant disks (RAID 1 or 5), so that one disk can break without loss of data,
using an undelete system (or not making mistakes when deleting files
locking up computers.

These help, but if there is anything you do not want to lose on the computer, make sure there are backups and they can be restored.

What to backup?

If there is room on the backup media, and time limits permit running backups long enough, it probably is wisest to back up everything. You may skip /tmp or other places where it is known there are only temporary files that nobody wants to backup.

If space or time limits place restrictions, consider not backing up the following

Files that come directly from a CD or other removable media. It may even be faster to copy them again from CD than restoring from backup media.

Files that can be regenerated easily. For example, object files that can be made with make. Just make sure all the source files and compilers are backed up.

If the Internet connection is fast, it may be easy enough to download files again. Just keep a list of the files and where to download them from.

Backup devices and media

You need some media to store the backups. It is preferable to use removable media, to store the backups away from the computer and to get "unlimited" storage for backups.

If the backups are on-line, they can be wiped out by mistake. If the backups are on the same disk as the original data, they do not help at all if the disk fails and is not readable anymore. If the backup media is cheap, it is possible to take a backup every day and store them indefinitely.

Floppy,Disk,Tapes,CD-R and CD-RW are the medias available for backup

Planning a Backup

Before doing a backup, plan it carefully. Consider:

Which files are irreplaceable without a back up. Irreplaceable files probably include those in users' home directories (including /root), and configuration files, such as those in the /etc/ directory.

Which files are on removable drives, such as cd s or floppies. Since you probably do not need to back up removable drives, you might unmount them before doing a complete system backup.

Which files can be easily replaced by installing a package or doing a selective install or upgrade of the operating system. You can save time and storage space by not including these files in a backup.

Which files are unnecessary or dangerous to backup. For example, files in /tmp are probably unnecessary, while restoring some files that are in the /proc directory could crash the system.

Whether to compress files using gzip or bzip2 . Compressing saves space, but adds another step to the backup. Also, while compression is generally reliable, it creates another stage at which the process can fail.

Whether users are responsible for backing up their own files. Since only the root user has full permissions for all files on the system, usually backups are best done by the root user. However, if users back up their own files, you might omit backing up the home directory, or at least not back it up regularly.

Choosing a Backup Tool

Linux has several tools for backing up and restoring files

dump / restore : Old tools that work with filesystems, rather than files, and can back up unmounted devices. Although you can easyly control what is backed up with dump by editing a single column in the /etc/fstab file, for some reason these utilities have fallen into disuse. Today, many distributions of Linux, including Debian, do not even include them by default. If you want to use dump and restore , you must install them yourself.

tar : A standard backup tool, and by far the easiest to use. It is especially useful for backing up over multiple removable devices using the -M option.

cpio : A very flexible command, but one that is hard to use because of the unusual way in which the command must be entered.

Many commercial or free software back up tools are also available.