Linux Administrator Manual (8) - Backup

xiaoxiao2021-03-06  84

Linux Administrator Manual (8) - Backup

Http://www.lelew.com/ 2004-05-10 13:05:14

Hardware is not definitely reliable software. It is definitely unreliable. It is unreliable and natural is definitely reliable. This shows why. The important data for backup is valuable. Regeneration It requires you to spend time and effort, and spend money or at least sad and tears, sometimes it is impossible to re-generate, such as some experimental results. Since data is an investment, you must protect it and take steps to avoid loss. Lost data is generally 4 reasons: hardware failure, software curve, human factors or natural disasters. Although modern hardware is quite reliable, it may still be naturally damaged. The most decisive hardware that stores data is a hard disk, which relies on tiny magnetic areas to save data in the world full of electrical noise. Modern software is still unreliable, a truly reliable procedure is ideal, rare, not law. People are more unreliable, they are easy to make mistakes, even maliciously destroy data for some purposes. Naturally, it may not be evil, but it may also cause damage. Everything, I hope everything is normal, perfect is almost impossible. Backup is a method of protecting data investment. There are multiple copies of data, they are not afraid of a certain damage (the required data is only recovered from the backup). The right backup is very important. Just as anything in the physical world is related to other related, backup will have time to fail sooner. Good backup ensures effective, you don't want your backup to be invalid. If your backup is broken, this will add snow, if you only have a backup, it may be bad at all, leaving only the ashes in your hard drive. Or when you recover, I have found that I forgot to back up some important things, such as the user database of 15,000 user sites. Best of all, all your backups might be working perfectly, but the last known tape drive reading the kind of tapes you used was the one that now has a bucketful of water in it. When it comes to backups, paranoia is in the job description The most important decision required to select the backup media backup is to select the backup media. Need to consider cost, reliability, speed, availability. Cost is important because your data may require multiple storage, multiple backups. Cheap media can be used. Reliability is the most important, because bad backups will add snow. Backup media must be able to store data for many years without damage. As the backup medium, the use method affects reliability. The hard drive is generally very reliable, but as a backup medium is not very reliable, if it and backup originates in the same computer. Speed ​​is often less important, if the backup can be done non-interactive. Backup spends 2 hours without no need to supervise, how long it doesn't matter. On the other hand, if The Computer Would't Be Done When The Computer Would OtherWise Be idle is also a problem. It is possible to be obvious because you cannot use a backup medium that does not exist. Not too obvious is to get this medium in the future and can be used on other computers. Otherwise, you may not be able to restore your backup. Availability is the main factor in determining the backup cycle. The easier the backup is used, the better. Backup media cannot be used. Generally, floppy discs and tapes are used. The floppy disk is very cheap, it is reliable, not too fast, it is easy to get, but the amount of data is not easy to use. Tape is also very cheap, it is reliable, it is fast, it is easy to get, but also, depending on the capacity of the tape, it is easy to use. There are other options. But usually is not good, but if this is not a problem, sometimes it is good.

For example, a magneto is also a floppy disk (random access, quickly restores a single file) and tape (large capacity). Choosing a backup tool backup There are many tools, traditional UNIX backup tools are Tar, CPIO, and DUMP. Alternatively, a large number of third-party packages (including FREEWARE and commercial versions) can also be used. The selection of backup media may affect the choice of tools. TAR and CPIO are similar, from backups to see the basic equivalent. You can save the file to the tape and remove the file. Almost all media can be used, because the core device driver handles low-level device operations, which seems to all devices in the user-level program. Tar and CPIOs with Write a UNIX version are not ordinary files may have problems (symbolic connection, device files, extremely long path names), but Linux can correctly process all files. Different DUMP, it directly reads the file system without passing the file system. IT IS Also Written Specify for Backups; Tar and CPIO Are Really for Archiving Files, Although They Work for Backups As Well. It is a bit advantage that it may not consider all files for Time Stamps backup; for TAR and CPIO, you must first File system read-only installation. Direct reading the file system is more efficient, if all things are backed up because it moves the head to minimize. Its main disadvantage is that each file system species requires a specific backup program, and Linux's DUMP program only understands the EXT2 file system. DUMP also supports backup level (discussed below); for TAR and CPIO, this must be implemented with other tools. The third party backup tool is more than the scope of this book. Linux Software Map lists many freeWare. Simple Backup A simple backup solution is a backup of everything, then back up all the last backups changed. The first backup is called full backup Full Backup, and later called I incremental backup NCremental Backups. The full backup is more cost-effective than the incremental backup, because there are more things written to the tape, and all backup may not be in a plate (not to say the floppy disk). Recycling incremental backups may take more time than full backup. Backups can optimize this, which is a total of all modified files in the last full backup. This way, backups may need more work, but you only need to return a full backup and an incremental backup. If there is 6 disk magnetic speck, you can use the tape 1 to do the first full backup (for example on Friday), with a tape 2-5 to make an incremental backup (Monday to Thursday). Then use the tape 6 to do new full backup (second Friday), then use tape 2-5 to make incremental backups. Do not cover old full backups (tape 1) before doing new full backups, and problems when you do full backup. After a new full backup tape 6, it is best to save tape 1 in another place, so if there is a full backup tape loss in the fire, there is one. When the next full backup is, the tape 6 is saved again with the tape 1. If you have more than 6 disk tape, you can use multiple full backups. Every time you do full backup, you should use the oldest tape. This way you will have a full backup of the recent weeks, and if you want to find a file that has already been deleted, or the old version of a file is useful. Backup with TAR backups can be easily implemented with TAR: # tar -create -file / dev / ftape / usr / src tar: removing leading / from absolute path name in The Archive # Using the GNU version of TAR and Its long selection name. Traditional version of TAR only understands the single character option.

The GNU version can also handle a plate or a disk that cannot accommodate backup, and a long path name; this is not all traditional versions. (Linux only uses GNU Tar.) If your backup of a tape does not hold, you need to use -Multi-Volume (-M) option: # tar -cmf / dev / fd0h1440 / usr / src tar: removing leading / from absolute Path Names in The Archive Prepare Volume # 2 for / dev / fd0h1440 and hit return: # Note Before starting backups, you must format all floppy disks before TAR needs to format it with another virtual console or virtual terminal. After backup, you should check if it is intact, use -compare (-d) option: # tar -compare -verbose -f / dev / ftape usr / src / usr / src / linux usr / src / linux-1.2.10- Includedes / .... # Failed backups means that if you lose the original data, the backup cannot be recovered. Incremental backups can be implemented with -newer (-n) option: # tar -create -newer '8 Sep 1995' -file / dev / ftape / usr / src -verbose tar: removing Leading / from Absolute Path Names in The Archive USR / SRC / USR / SRC / Linux-1.2.10-Includes / USR / SRC / Linux-1.2.10-Includes / include / usr / src / linux-1.2.10-incdude / include / Linux / USR / SRC / Linux-1.2.10-incrudees / include / Linux / modules / usr / src / linux-1.2.10-incrudes / include / asm-generic / usr / src / linux-1.2.10-incruDes / include / asm- I386 / USR / SRC / Linux-1.2.10-includees / include / asm-mips / usr / src / limited-1.2.10-incrudes / include / asm-alpha / usr / src / linux-1.2.10-incruDes / INCLUDE / ASM-M68K / USR / SRC / Linux-1.2.10-includees / include / asm-sparc / usr / src / patch-1.2.11.gz # unfortunately, TAR can't know the I node information change of a file For example, the rights bit change of the file, or the file name changes. This can use the find command and compare the current file system status and a list of files previously backed up. Scripts and programs for this can be found on the Linux FTP site.

Use tar returned TAR -EXTRACT (-X) option to expand file: # tar -extract -same-permissions -verbose -file / dev / fd0h1440 usr / src / usr / src / linux usr / src / linux-1.2.10 -includes / usr / src / linux-1.2.10-incrudees / include / usr / src / linux-1.2.10-incruDes / include / Linux / USR / SRC / Linux-1.2.10-includees / include / Linux / HDREG .h usr / src / linux-1.2.10-includees / include / linux / kernel.h ... # can also use the command line to expand only specific files and directories (and the files and subdirectories): #TAR XPVF / DEV / FD0H1440 USR / SRC / Linux-1.2.10-includees / include / linux / hdreg.h usr / src / linux-1.2.10-incruDes / include / Linux / hdreg.h # with -list (-t) option See a file in a backup volume: # tar -list -file / dev / fd0h1440 usr / src / usr / src / linux usr / src / linux-1.2.10-incruDes / usr / src / linux-1.2.10- INCLUDES / include / usr / src / linux-1.2.10-incrudees / include / Linux / usr / src / linux-1.2.10-incrudes / include / linux / hdreg.h usr / src / linux-1.2.10-incruDes /include/linux/kernel.h ... # Note Tar is always read a backup volume in order, so a big volume will be very slow. Random access database technology is not possible when using a tape drive or other sequential medium. TAR does not deal with the delete file properties. If you need to restore a file system from a full backup and an incremental backup, and 2 backups have deleted a file, and this file exists after you recover. If this file contains sensitive data that should be deleted, this is a big problem. The chapters above the multi-level backup summarizes the simple backup method, is used for individuals using or small sites. For most heavy load, multi-level backups are more applicable. Simple backup has 2 backup levels: full backup and incremental backup. You can usually have any number of backup levels. Full backup is 0 level, different levels of incremental backups are 1, 2, 3 ... level, each incremental backup level backup of the same or last backup of the last backup changes. Such a more purpose is to allow longer backup history Backup History. In the previous example, the backup history traces it to the previous full backup. Can increase the magnetic band to extend backup history, but each new tape is extended for a week, which may be too expensive. A longer backup history is useful because deleted or damaged files may not be discovered for a long time. Even if it is not the latest version of a file, it is better than not good. Multi-level backups can extend backup history more enlarged. For example, if you have 10 disk tape, you can use tape 1 and 2 for monthly backup (first Friday, the first Friday), tape 3-6 is a weekly backup (other Friday, because the month may have 5 Friday) Therefore, a 4-disc tape is required), and the tape 7-10 is ready for daylight (Monday to Thursday). Only 4 disk tape is increased to extend the 2 weeks of backup history to 2 months. It is true that we can't restore all versions of each file in this 2 month, but this recovery is often good enough. Backup levels allow file system to recover minimum time. If you have a lot of incremental backups for the number of monotonous growth levels, you need to recover the entire file system, you need to reply to all backups. And if the number of levels is not monotonous growth, the number of backups and returns can be reduced.

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

New Post(0)