LINUX Backup Strategy Research

zhaozj2021-02-12  141

Everyone tells you how the backup is important, but it is currently lacking how to back up a detailed tutorial to discuss which files need to be backed up, how much should the backup interval? This article will answer these questions, you can define the backup strategy that suits you through this article. In general, you can divide the backup into two categories: system backup, its backup to the operating system and application (as long as the system administrator can perform this work); user backup, its backup of the user file ( I don't know if someone else uses these terms, but this article is used in this article). We will see that system backups and user backups should be taken differently. System backup The reason for system backup is that it can quickly and easily completely recover the system quickly and easily after the system crash. However, of course, you will not take a few months to back up your system. The most effective way to perform a valid backup is to back up only the data necessary for system crash recovery. Think about this situation, most of your system is very stable - / usr / bin content is not so often changed, in order to make things simplify, you may already have a system's rough copy. Most people use some kind of release to install the Linux system and then make their own customization. The original release is the starting point for us to restore system recovery. Linux distinguishes with one aspect of many other operating systems is an operating system and most applications at a time, and Windows or other UNIX systems are installed separately by the application and the operating system. First, install the operating system, then Each application is gradually installed. For these systems, the backup of the entire system is necessary, and these operating systems need to spend a lot of time and effort when installing. For Linux, a basic system (including most applications) is very simple and fast for the first or again. It is very stable to say that the system is very stable. Let's consider which part is relatively easy to change. One aspect of customizing your own system is to install a new application (there is no application installed). When installing new software, you should strictly demand yourself, separated from the newly installed software and initial installation, and the most appropriate directory location is / usr / local. The purpose of the / usr / local directory is to include those "localization" relative to the system. One advantage of this is that you can easily see which programs can be recovered from the release CD and which programs need to be recovered from backups. Another place where you want to modify is the configuration file used by the standard program. The profile of most Linux applications is a plain text formality, and you can edit the configuration file as needed to customize the operation of the software. Sometimes I will automatically edit some configuration files based on your answer, but in most cases you need to edit them yourself. Many important files are under the / etc directory, such as: / etc / printcap --- Configure how to communicate with the printer / etc / fstab - What file system / etc / etc / etc / etc / etc / passwd --- contains all user information Such as password, login shell, etc. / etc / inittab - configure init on how to start system / etc / xf86config at different run levels, etc. It can be seen that the / etc directory is very important, and the files contained in this directory may be a few hours of work. I have spent a long time to configure the XF86config file correctly. I think that if I re-do it again, I am afraid. Of course, some programs use some files in other directories, but the vast majority of Linux's basic configuration files are located in the / etc directory. When you modify the configuration file used by a program, you cannot move it elsewhere because the program is usually looking for a configuration file in a fixed place.

Therefore, the revision made to the system is very important, regardless of how the changes are made, so that the system can be easily recovered when the system crashes. The best tool to record the system is a pen and a piece of paper. The detailed description of the system is made under the record and why it is necessary to modify it. Don't think so, think that after six months, you can still remember how you compiled an application, or why you want to modify a configuration, and the actual situation is that you often forget. Even if you install a new software in a separate directory (more easy to find modification), you should also record how to install the program, when you installed and if there is anything is not very clear. Now we have discussed which system files need to be backed up. Here we consider how long it should be backed up. Each time you modify the system, you may be a backup moment, but don't forget to back up some of the part you want to modify before modifying the system to prevent recovery when you have problems. The key point is that the system only changes after you have modified it, and the modification is often not a frequent thing, so the backup of the system should correspond to this situation. User backup user backup is different from the system backup because the user's data variation is more frequent, so it is almost impossible to establish an accurate to a user to a backup of each minute. When the user data is backed up, you just provide a virtual secure network - reasonable recently the backup of its data files, and use the user to restore your own data when any problems occur when any problems are deleted, if the hard disk is deleted, the user can restore its own data. User backups should be more frequent than system backups, perhaps backup every day (CRON program provides methods for automatically run a program). Almost all backup programs (including tar) provide a useful feature: only the files modified after a specific time (such as the last backup). This can significantly reduce the time required to make user backups, because a user is generally only modified in a specific time period. You can use the user data to fully back up and the means of incremental backups. Although the floppy disk can be used as a backup storage medium, each floppy disk can only store a small amount of data. Many backup programs allow a backup of several disks, but this also means that the floppy disk must be replaced when you are backup. If you just manage small systems with several users, this may be very simple, but the situation is often not the case. Digital or magnetic recordings may be a better choice because they have larger storage capacity. Linux supports many different types of tape devices, or through the FTAPE module or by support for SCSI (digital recording tapes are often SCSI devices). And the cost of tape devices is now very useful from cost-effective, so it is very practical. Optionally, your Linux may and other computers with a tape drive in the same LAN, Linux can access tape devices for other remote machines. Regardless of whether to back up, you need to manage these media devices. Your backup will only be used when you have problems, then you will rely on backup, so you must often verify your backup. A backup that is not verified is even worse than no backup. You should also keep multiple backup collection, a popular strategy is based on "Grandfather - Father - Son" Thought. Here you have three sets of backups, the latest (son), one of the oldest (father), the oldest copy (grandfather). When you carry out the next backup, you should overwrite the oldest copy to make it the latest. The advantage of this strategy is that even one of them, you can still recover according to other backups, but you don't have to make two backups each time. The last advice may be somewhat surprises: keep at least one backup remote from the source machine, preferably in another building. why? This is to prevent disasters such as fires in the source of the source, you can re-use a new machine, use new Linux release, but you can't get a new backup tape.

The data in the computer is the most precious, irreplaceable, so protect it carefully. How to back up OK, the theoretical part is already enough, let's take some example below. There are a lot of backup programs to choose from, including free software and business software, each has its advantages. But we use TAR (GNU Version 1.11.2) to be used as an example. Here, it is assumed that many new software has just been installed in / usr / local in / usr / local, and requires all the contents under / usr / local in the backup system. Here you don't have a tape device, so you use the floppy disk, use the following command: $ tar -cwmf / dev / fd0 / usr / local c option ID Create a archive, W Represents it to read back of the backup content to the backup device Verify verification to improve reliability, M option indicates that the TAR can span multiple disks when needed, and the F option notifies where the archive is written, where is / dev / df0. In many systems, you must have root identity to access / dev / df0. $ TAR -TMF / DEV / FD0 will display a list of files for the disk backup. Depending on the size of the content under the / usr / local directory, you will need a plurality of floppy disks to back up the contents of the directory, of course, can reduce the number of required disks with tar commands, this option specifies TAR to archive Use GZIP to compress the compression to reduce the archive size. This feature is good and bad, the advantage is that the memory size can be reduced, and the damage to any one of the compressed archives will cause the entire archive to be unrecoverable. Some programs are compressed separately from these files before the backup file, and a good idea is at this time. I mentioned the file that can be modified after a certain time, you can use the N option to make such an archive, for example: $ tar -cf / dev / ftape -n yesterday / home will back up the / home directory All documents modified after yesterday. This time data is backed up to the soft tape device / dev / ftape. Another optional way to achieve this function is to use Find and Tar commands in combination: $ find / home -cnewer / etc / last_backup -type f i-print> back_these_up $ tar -cf / dev / ftape -t back_these_up $ touch / Use the ETC / LAST_BACKUP FIND command to find all files that have changed after / etc / last_backup modified, and store the lookup results in the file back_these_up, T option indicates all the files specified in the TAR command backup file back_these_up; Subsequent Touch file / etc / last_backup, which will be used as the time point of the next backup. It is very useful to connect several such commands together. As a by-product of our list of the names of our backup file, and the latest backup time. (Document ETC / LAST_BACKUP timestamp). Another thing we can do is a list of filtered files, so that the specific file is not backed up. For example, you may want to not back up the object file or DVI file because they can be generated by the source file.

转载请注明原文地址:https://www.9cbs.com/read-7060.html

New Post(0)