|
Blue Forest http://www.lslnet.com at 3:18 p.m. on August 18, 2006
Backup Linux Environment Linux System Administrator is a question often asked : How can I backup system? For the Windows system, for backup is a simple (just click the mouse in the menu mode can be completed).
Linux will back trouble, and if you are not familiar with Linux system documentation and equipment, the situation will become worse. The article discusses the methods of data protection on Linux and related equipment information.
?
1, what is backup?
Simply speaking, the process of data backup copy of important data to other top media (usually mobile) to ensure that the original data can be lost in restoring data. Backup is a simple cp may order a paper catalog of other complex systems, and may also be used to process data flow specific to a particular device into the complicated process. Many cases is to be included in the data to tape backup machine, but in some cases is not the case. Under Linux, or other Unix systems, backup paper copies could be found to the existing file system, replacing the paper system, tape machines, remote file system, or even a tape machine on the remote system. Of course, from a user's point of view, there is no tape or zip drive concept, it is only paper.
?
2, which should choose a backup equipment?
?
There will be a lot of himself to be "the perfect backup choice" equipment, including tape, portable disk drive, and even the mysterious Internet Backup System. For backup operations, providing the most reliable tape storage methods. Why is the tape? Of course, Iomega's Jaz or Zip drives appear to be interesting backup tool, but they easily collapse of the hard drives in the case file system as the reasons which led to problems. Backup for the Internet, when you can not visit because of the collapse of the Internet system, it can not restore the data. Similarly, you can really trust your remote data stored in other systems?
Therefore, we have chosen the tape machine, but how to access the tape machine? As the article mentioned earlier, and the Linux system, a state of the user's point of view, any document can be seen. Therefore, it can be "opened" to the appropriate documents into the tape drive operations to a backup data into that document. Although it seemed too simple, but the actual situation is this. /dev Under Linux root file system contains a list of all the physical equipment and related documents. When the operation of these documents, and is in fact lower the physical operation of equipment. The table below shows how the Linux environment equipment and documents linking the physical equipment :
Equipment (Device), returns (Rewinding) back volumes (No-Rewind)
1st SCSI tape drive /dev/st0 /dev/nst0
2nd SCSI tape drive /dev/st1 /dev/nst1
Nth SCSI tape drive /dev/st[n-1] /dev/nst[n-1]
1st ATAPI tape drive /dev/ht0 /dev/nht0
2nd ATAPI tape drive /dev/ht1 /dev/nht1
Nth ATAPI tape drive /dev/ht[n-1] /dev/nht[n-1]
1st CFTD tape drive /dev/ft0 /dev/nft0
As it saw in the table, in view of such equipment are based on equipment, types of hierarchical structure of the logic of digital equipment, rather than its physical ID (SCSI) or Channel IDE (ATAPI). Therefore, even if the aircraft was assigned to a SCSI disk SCSI device ID4, the chain if it is a SCSI tape equipment, it will be
/dev/st0.
Instead /dev/st4 this naming convention is conducive to a tape recording equipment tracking system, even with multiple tape drive types of equipment. Similarly, in the 2.0.X kernel, which only supports a single ATAPI equipment, the use of more than 220 versions of the kernel can ATAPI drive (ht0.
Ht1 that. . . ). |
Backup Linux Environment 3, visit the facilities under Linux
In the Linux environment, the equipment is to visit the facilities and their associated documents nodes. These nodes at /dev catalog, but not to confuse the concept-a node equipment is not just a simple document. When opening a node equipment for the visit, the special attributes to their notice which is a core operation of the physical facilities. Each node has a document from the association and the owners (major
And minor number) and attribute types of equipment, such as aircraft equipment for SCSI tape nodes as follows :
Crw-rw-rw- root operator 9 1 0 0 1 Dec Democracy /dev/st0
The first "c" indicates that the equipment is a character equipment (I/O means that the equipment in each operation only deal with a character), the main issue for 9 from No. 0. Its main use as an address to which notice Kernel Device Driver, and from its definition of the equipment was used to a particular example of the function. If the document node does not exist? Linux provides an equipment order to facilitate the creation of a joint document-mkmod order following form : |
Backup Linux Environment Mknod /dev/node_name [c|b] major minor
However, if no suitable equipment node system, the core of whether or not to support the need for this type of detection equipment. This can be done through an order cat
/proc/devices The output to see, in my system, as follows :
Character Devices
1 mem 10 misc
2 pty 14 sound
3 ttyp 21 sg
4 ttyS 29 fb
5 fluctuating cua 37
7 vcs 128 ptm
9 st 136 pts
Block Devices
1 ramdisk
2 fd
3 ide0
9 md
22 ide1
Many managers in the operation of equipment will be encountered on mt rollback order problems. Mt order to achieve operating a "tape" equipment. For example, orders mt - f /dev/st0 eod
Order to set up tapes for the additional backup prepared /dev/st0 tape data will advance to the end of preparing the new impose additional backup operations, but because of rollback st0 equipment, tape machines in positioning data to end immediately returns to the beginning and closed tape equipment (because st0 a rollback equipment). Backup operations will be covered at this time if the data tapes and the tapes are not attached to the end of the new Department data. The use of non-rollback equipment will be put mt eod tapes remain in the position, then the backup operation will be added to the end of the last backup.
This solution is recommended for the use of non-rotating equipment in the hope of establishing links symbols, such as : /dev/tape, mt - f parameter is not provided in order to use /dev/tape to operate the equipment. If the system has a number of tape equipment, it means you can use the link symbols and the use of environment variables TAPE=/dev/nst[x] to achieve the same results. For the above two methods, in order not to use to use mt - f parameter, for example : mt
Eod, it will automatically use the correct location of the medium, which is used without concern /dev equipment.
4, the basic Linux backup method
Now that we have discussed how to transfer tape equipment, and we have to know how to use rollback or rollback equipment. But how will the paper tape equipment to be removed from the system? This is the function of backup tools. Linux has all the tools to provide a backup of all the ancestors : tar (of course, and actually dbppt bppt.
WMD dump and restor is Unix System Backup tools Adam). Tar Unix Version 7 in the order. The order of names from the "Tape
ARchiver. " The order was designed to be very easy to achieve data from the backup tapes or restoring data from tapes.
Tar orders for the basic grammar :
Tar -mode -option [files]
C create expressed here (backup), x extraction (restore), or t contents list (list), options include the following elements :-V said details such as export-f
Express purpose file (model building), or source (or from the table model), more detailed information, please refer to the manual system tar order (man tar).
Backup very simple to use tar as follows :
Tar -cvf /dev/st0
Lost+found/
Var/
Var/adm/
Var/adm/LST/
Var/adm/LST/log/
Var/adm/LST/log/debug
Var/adm/LST/log/history
Var/adm/LST/log/cmd.trace
Var/adm/LST/log/install.success
Var/adm/LST/log/postin.failed
Var/adm/LST/log/install.failed
Var/adm/LST/analyse/
Var/adm/LST/analyse/boot.img
Var/adm/LST/analyse/boot.msg
Var/adm/LST/analyse/boot.info
Var/adm/LST/analyse/boot.diag
Var/adm/LST/analyse/boot.params
Var/adm/LST/database/
Var/spool/
[...]
The order said the c option to create a new backup (c), and also through the use of detailed models (v), and exports to the entire system backup /dev/st0 (f). Under such circumstances, the operation would open /dev/st0 tar paper (equipment), the data format of the data stream into a tar which opened to the paper, and after all the data has been included in the closure document. Volume equipment back here because we chose /dev/st0 paper (storage medium) device driver will return after the paper closed in tar tapes.
The next step will be to verify the data to be written into the correct tapes. Unfortunately, the tar Linux environment provided a more just order means test mode - which has been re-reading the tape, and the original documents by byte comparison. However, it is still a lot better than no test. Because the tapes were discovered during restoration of bad data is a very bad thing.
Certification was restored in the end and after all is not yet over, because the data system is constantly changing, evolving to maintain a backup system is going to change the regular data backup. There are many ways that we can achieve this backup, but is the most convenient increment (incremental) and the difference (differential) backup.
Both methods rely on the backup in time, or are based on the last backup (incremental), or based on the last complete backup. Backup incremental backup only those modified since the last backup of the data, sometimes also known as the conventional backup; Backup and differential backup will only changes since the last complete backup of documents. The following table shows the characteristics of several backup programs comparison :
5, fully differential backup Incremental Backup Backup
Most Least Less than Full use of space
Faster than the speed Slowest Fastest Full Backup
Faster than Incremental restore Slowest speed Fastest
Incremental Backup Backup Backup difference may be overlooked data, but the difference incremental backup faster than the speed of restoration because it needs a complete backup and the last differential backup; Required from the last full backup and incremental backup and incremental backup every time since.
To users write backup methods, or need to use tar order N --newer choice behind with a time that is usually the time the calendar format (for example : 03/12/199 = March
12th, 1999).
Tar -cvf /dev/st0 --newer 03/12/1999 /
The Order will all backup system in March 12th, 1999 and subsequent amendments to the document.
Now I offer a simple script file to complete the same time as a model of automation and differential backup. In the script before the first script Please note that the definition of environmental variables inspection to meet their own needs.
#!/bin/sh
#
#######################################
#
# TAR backup script to cover daily and weekly backups on one tape.
# Generic UNIX version - variables as required, 1976
#
# For this to work, it Usage be started on a Monday!
#
# Copyright (c) 1999, Tim Jones
# Permission granted for use/modification
#
Tim Jones/Linux Magazine # provide this shell script with no warranty
# (Implied or otherwise)
#
########################################
DOW=`date +%w`
DATE=`date +%D`
DAY=`date +%A`
DEVICE= "MY REWIND TAPE" # Rewinding tape drive
NDEVICE= "MY NO_REWIND TAPE" # non-rewinding tape drive
REWIND= "$DEVICE rewind mt - f"
EOD= "$NDEVICE eod mt - f"
FSF= "mt - f $NDEVICE fsf"
MAILLIST= "root" # list of users to receive back-notice
If [$DOW = "6"]
Then
# This is Saturday, so append and write the whole system!
$EOD
Echo $DATE "; /tmp/.LASTFULL
Tar -cvvf $NDEVICE / ";/tmp/backup.txt
$REWIND
$FSF 5
Tar -dvf $NDEVICE ";>; /tmp/backup.txt
$REWIND
Cp /tmp/.LASTFULL /etc/.LASTFULL
Else
# This is not Saturday
$DOW In case
0)
Mr Bruce Hicks, it's #-nothing to do
Exit 0
;;
1)
# 16-18, Let the tape rewind for the difference verification
Echo $DATE "; /tmp/.LASTINC
Tar -cvvf $DEVICE --newer `cat /etc/.LASTFULL` / ";/tmp/backup.txt
Cp /tmp/.LASTINC /etc/.LASTINC
;;
*)
# Other Days, must manually rewind and Inspect, -i
$EOD
Echo $DATE ";/tmp/.LASTINC
Tar -cvvf $NDEVICE --newer `cat /etc/.LASTINC` / ";/tmp/backup
$REWIND
$FSF `expr $DOW - 1`
Echo "************ Verifying ${DAY}'s backup," and ";>; /tmp/backup.txt
Tar --dvf $NDEVICE ";>; /tmp/backup.txt
Cp /tmp/.LASTINC /etc/.LASTINC
$REWIND
Esac
Fi
Mail $MAILLIST "/tmp/backup.txt
Rm-f /tmp/backup.txt
# Sleep OF SCRIPT |
Backup Linux Environment Haotie. Or complicated ah -_- |
Backup Linux Environment Please specify the source later posted |
Backup Linux Environment There is no difference on how Linux in a hard disk backup article time, I found a long time, the results are done on the backup tapes. |
| |