40. BACKUP AND RECOVERY METHODS Flashcards
Learning Objectives
By the end of this chapter, you should be able to:
- Identify and prioritize data that needs backup.
- Employ different kinds of backup methods, depending on the situation.
- Establish efficient backup and restore strategies.
- Use different backup utilities, such as cpio, tar, gzip, bzip2, xz, dd, and rsync.
- Describe the two most well-known backup programs, Amanda and Bacula.
Why Backups?
Name a few reasons to back up data?
- Data is valuable
- Hardware fails
- Software fails
- People make mistakes
- Malicious people can cause deliberate damage
- Unexplained events happen
- Rewinds can be useful
What Needs Backup?
Some data is critical for backup, some less critical, and some never needs saving.
What data should be backed up?
Definitely yes
- The following data should always be backed up:
- Business-related data
- System configuration files
- User files (usually under /home)
Maybe
- Spooling directories (for printing, mail, etc.)
- Logging files (found in /var/log, and elsewhere)
Probably not
- Software that can easily be re-installed; on a well-managed system, this should be almost everything
- The /tmp directory, because its contents are indeed supposed to be only temporary
Definitely not
- Pseudo-filesystems such as /proc, /dev and /sys
- Any swap partitions or files
Obviously, files essential to your organization require backup. Configuration files may change frequently, and along with individual user’s files, require backup as well.
Logging files can be important if you have to investigate your system’s history, which can be particularly important for detecting intrusions and other security violations.
You don’t have to back up anything that can easily be re-installed. Also, the swap partitions (or files) and /proc filesystems are generally not useful or necessary to backup, since the data in these areas is basically temporary (just like in the /tmp directory).
Backup vs. Archive
All backup media have a finite lifetime before becoming unreadable. The conventional estimates are listed below:
- Magnetic Tapes: 10-30 years
- CDs and DVDs: 3-10 years
- Hard Disks: 2-5 years.
- Lifetime is very sensitive to:
Environmental conditions (temperature, humidity, etc.)
- Quality of media
- Having working software that can read data on current operating systems and hardware.
- Lifetime is sufficient for backup, but not for permanent digital archiving.
For lifetimes longer than the usual backup timescales, data can be preserved using multiple copies, plus copying over to newer media from time to time.
For very long times (i.e., many decades, centuries, etc.), standard methods do not work easily, as everything can go obsolete: hardware, software and document format, media.
None of the inexpensive digital formats can actually compete with paper and film for long periods of time (if they are properly stored and continuously cared for - like wine).
This is a problem serious people think about and there should be good solutions available before all is lost.
Tape Drives
Tape drives are not as common as they used to be. They are relatively slow and permit only sequential access. On any modern setup, they are rarely used for primary backup. They are sometimes used for off-site storage for archival purposes, for long time reference. However, magnetic tape drives always have only a finite lifetime without physical degradation and loss of data.
Modern tape drives are usually of the LTO (Linear Tape Open) variety, whose first versions appeared in the late 1990s as an open standards alternative; early formats were mostly proprietary. Early versions held up to 100 GB; newer versions can hold 2.5 TB or more in a cartridge of the same size.
Day-to-day backups are usually done with some form of NAS (Network Attached Storage) or with cloud-based solutions, making new tape-based installations less and less attractive. However, they can still be found, and system administrators may be required to deal with them.
In what follows, we will try not to focus on particular physical forms for the backup media, and will speak more abstractly.
Backup Methods
What are the different types of backs?
You should never have all backups residing in the same physical location as the systems being protected. Otherwise, fire or other physical damage could lead to a total loss. In the past, this usually meant physically transporting magnetic tapes to a secure location. Today, this is more likely to mean transferring backup files over the Internet to alternative physical locations. Obviously, this has to be done in a secure way, using encryption and other security precautions as is appropriate.
-
Full
- Backup for all files on the system.
-
Incremental
- Backup for all files that have changed since the last incremental or full backup.
-
Differental
- Backup for all files that have changed since the last full backup.
-
Multiple level incremental
- Backup for all files that have changed since the previous backup at the same or a previous level.
-
User
- Backup only for files in a specific user’s directory.
Backup Methods
Explain the full backup method
Backup for all files on the system.
Backup Methods
Explain the Incremental backup method
Backup for all files that have changed since the last incremental or full backup.
Backup Methods
Explain the Differential backup method
Backup for all files that have changed since the last full backup.
Backup Methods
Explain the Multiple level incremental backup method
Backup for all files that have changed since the previous backup at the same or a previous level.
Backup Methods
Explain the User backup method
Backup only for files in a specific user’s directory.
Backup Strategies
We should note that backup methods are useless without associated restore methods. You have to take into account the robustness, clarity and ease of both directions when selecting strategies.
The simplest backup scheme is to do a full backup of everything once, and then perform incremental backups of everything that subsequently changes. While full backups can take a lot of time, restoring from incremental backups can be more difficult and time consuming. Thus, you can use a mix of both to optimize time and effort.
An example of one useful strategy involving tapes (you can easily substitute other media in the description):
- Use tape 1 for a full backup on Friday.
- Use tapes 2-5 for incremental backups on Monday-Thursday.
- Use tape 6 for full backup on second Friday.
- Use tapes 2-5 for incremental backups on second Monday-Thursday.
- Do not overwrite tape 1 until completion of full backup on tape 6.
- After full backup to tape 6, move tape 1 to external location for disaster recovery.
- For next full backup (next Friday) get tape 1 and exchange for tape 6.
A good rule of thumb is to have at least two weeks of backups available.
Some Backup Related Utilities
Name a few of the backup utilties
-
cpio and tar
- cpio and tar create and extract archives of files.
-
gzip, bzip2, and xz
- The archives are often compressed with gzip, bzip2, or xz. The archive file may be written to disk, magnetic tape, or any other device which can hold files. Archives are very useful for transferring files from one filesystem or machine to another.
-
dd
- This powerful utility is often used to transfer raw data between media. It can copy entire partitions or entire disks.
-
rsync
- This powerful utility can synchronize directory subtrees or entire filesystems across a network, or between different filesystem locations on a local machine.
-
dump and restore
- These ancient utilities were designed specifically for backups. They read from the filesystem directly (which is more efficient). However, they must be restored only on the same filesystem type that they came from. There are newer alternatives.
-
mt
- This utility is useful for querying and positioning tapes before performing backups and restores.
Some Backup Related Utilities
What is the cpio and tar back up utilities used for?
cpio and tar create and extract archives of files.
Some Backup Related Utilities
What is the gzip, bzip2, and xz back up utilities used for?
The archives are often compressed with gzip, bzip2, or xz. The archive file may be written to disk, magnetic tape, or any other device which can hold files. Archives are very useful for transferring files from one filesystem or machine to another.
Some Backup Related Utilities
What is the dd back up utilities used for?
This powerful utility is often used to transfer raw data between media. It can copy entire partitions or entire disks.
Some Backup Related Utilities
What is the rsync back up utilities used for?
This powerful utility can synchronize directory subtrees or entire filesystems across a network, or between different filesystem locations on a local machine.
Some Backup Related Utilities
What is the dump and restore back up utilities used for?
These ancient utilities were designed specifically for backups. They read from the filesystem directly (which is more efficient). However, they must be restored only on the same filesystem type that they came from. There are newer alternatives.
Some Backup Related Utilities
What is the mt back up utilities used for?
This utility is useful for querying and positioning tapes before performing backups and restores.
Using tar for Backups
tar is easy to use:
When creating a tar archive, for each directory given as an argument, ___.
all files and subdirectories will be included in the archive
Using tar for Backups
tar is easy to use:
When restoring, __.
it reconstitutes directories as necessary
Using tar for Backups
tar is easy to use:
It even has a –newer option that lets you do ___.
- incremental backups
Using tar for Backups
tar is easy to use:
The version of tar used in Linux can also handle backups that do not fit on one ___ or ___.
- tape
- whatever device you use