Whatever the system, the safest way. After debugging, make a backup. If you encounter any major problems, you can recover them directly, which is convenient and easy to handle.
The following describes the Linux backup and recovery methods:
The backup and recovery system is responsible for backup and recovery beforehand. In the current rapidly developing network environment, no information system on any network can guarantee absolute security. As long as there is a network, There will be various threats from the network. In order to defend against network attacks and intrusions, although we have introduced increasingly sophisticated intrusion detection systems and firewall systems, hacker intrusion methods have become increasingly sophisticated, they can always find the security vulnerabilities and deficiencies of these systems for intrusion, so the security events caused by network intrusion are increasing year by year.
In this case, it is difficult for us to ensure the absolute security of key systems in the network, so we need to adopt backup and recovery technologies. Backup and recovery technologies use storage media and certain policies to regularly back up system business data to ensure that data can be recovered as soon as possible during accidental data loss and minimize user losses. It is a very important core technology in the information security discipline.
Backup Technology in Linux
For backup and recovery, Linux provides tools such as tar, cpio, and dump. In this way, you can use the corresponding backup and recovery tools to implement the basic functions of backup and recovery based on the actual situation of the system without spending money to purchase.
Tar tool Introduction
Tar is a classic Unix Command that has been transplanted to Linux. Tar is the abbreviation of tape archive. It was originally designed to package files on tape. Now we mostly use it to back up a partition or some important file directories. We can use tar to package the entire directory tree, which makes it especially suitable for backup. You can restore all the archive files or expand separate files and directories from them. Backups can be saved to file-based devices or tape devices. Files can be redirected during restoration so that they can be replaced to a directory or system that is different from the one that originally saved them ). Tar is not related to the file system, so it is applicable to a wide range, it can be used in ext2, ext3, jfs, Reiser and other file systems.
Using tar is very similar to using file utilities such as Winzip and WinRAR in Windows. You only need to point it to a file or device, and then specify the file to be packaged, You can dynamically compress the archive file through the standard compression type, or specify an external compression program of your choice. To use bzip2 to compress or decompress a file, run the tar-z command.
The following is a simple example of using this tool for data backup:
Tar czvf-/root/code>/tmp/code_bak.tgz pack and back up all program files in the/root/code directory to/tmp/code_bak.tgz)
Tar xzvf/tmp/code_bak.tgz/root/code restore the backup directory file to the specified directory)
Cpio tool Introduction
Cpio commands can import or copy files from tar or cpio files. Cpio commands are compatible with tar commands, but these commands do not have the following functions:
Supports cpio and tar file formats;
Supports many old-fashioned tape data formats;
Can read the file name through a pipeline pipe-line.
Currently, only a few Linux software packages are released in cpio format. If you are interested in the details of the cpio command, you can use the "man cpio" command to read its user manual.
Dump and restore Introduction
Dump can execute functions similar to tar. However, dump tends to consider file systems rather than individual files. Dump checks the files on the ext2 file system and determines which files need to be backed up. These files will be copied to a given disk, tape, or other storage media for security protection. In most media, the capacity is determined by writing until an end-of-media mark is returned.
The program that works with dump is restore, which is used to restore files from the dump image. The restore command executes the reverse function of the dump. You can restore the full backup of the file system first, and the subsequent Incremental Backup can overwrite the restored full backup. Individual files or directory trees can be restored from full or partial backups.
Both dump and restore can run on the network. Therefore, you can back up or restore data from a remote device. Dump and restore use tape drives and file devices that provide a wide range of options. However, both are only applicable to ext2 and ext3 file systems. If JFS, Reiser, or other file systems are used, other utilities are required, such as tar. For example:
Dump 0f/dev/nst0/back up the ext2 File System to the first SCSI device)
Restore-xf/dev/nst0/home/code restores all data in the/home/code directory of the SCSI device to the disk)