Why do you need 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.
dd : The dd command is one of the original Unix utilities and should be in everyone's tool box. It can strip headers, extract parts of binary files and write into the middle of floppy disks; it is used by the Linux kernel Makefiles to make boot images.
Mondo : Mondo is reliable. It backs up your GNU/Linux server or workstation to tape, CD-R, CD-RW, DVD-R[W], DVD+R[W], NFS or hard disk partition. In the event of catastrophic data loss, you will be able to restore all of your data [or as much as you want], from bare metal if necessary. Mondo is in use by Lockheed-Martin, Nortel Networks, Siemens, HP, IBM, NASA's JPL, the US Dept of Agriculture, dozens of smaller companies, and tens of thousands of users.
Dar: dar is a shell command that backs up directory trees and files. It has been tested under Linux, Windows, Solaris, FreeBSD, NetBSD, MacOS X and several other systems
Many commercial or free software back up tools are also available.
Types of Backup
There are different kinds of backups, the following lists some of them:
Full backup is the starting point for all other backups, and contains all the data in the folders and files that are selected to be backed up. Because full backup stores all files and folders, frequent full backups result in faster and simpler restore operations. Remember that when you choose other backup types, restore jobs may take longer.
Restore is the fastest
Backing up is the slowest
The storage space requirements are the highest
Incremental backup means backing up everything that has changed since last full backup.
Backing up is the fastest
The storage space requirements are the lowest
Restore is the slowest
Differential seems to be another name for incremental.differential backup offers a middle ground by backing up all the files that have changed since the last full backup
Restore is faster than restoring from incremental backup
Backing up is faster than a full backup
The storage space requirements are lower than for full backup
Restore is slower than restoring from full backup
Backing up is slower than incremental backup
The storage space requirements are higher than for incremental backup
Network backup usually means backing up a client to a backup server, this means the client sends the files to the server and the server writes them to backup medium.
Dump backups are not ordinary file by file backups. The whole disk partition or file system is "dumped" to the backup medium as is. This means it is also necessary to restore the whole partition or file system at one go. The dump backup may be a disk image, which means it must be restored to a similar disk with same disk geometry and bad blocks in same places. Watch out for this.
Level 0 -- 9 Backup
Level 0 to 9 backups are a finer grained version of incremental backups. Level N backup means backing up everything that has changed since a same or lower lever backup.
Check the backup can be restored, with original file owners, permissions and timestamps.
To be useful, you must be able to restore the backup. Very often not only the contents of file are important, but their time stamps, permissions and owners. Check that you can restore the backup so that all these are preserved.