Article Title: Linux and Unix file system backup and recovery methods. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Backup target: User File or entire File System
Key backup Problems
Backup Frequency
Backup content
Backup media
Backup Device Selection
Backup tools include:
Dump, restore
Volcopy, labelit
Tar, cpio, dd
Backup tools from third-party vendors
Three backup methods
Full backup (Normal backup): backs up all selected files and folders (whether or not they are set as archive attributes), and removes the backup mark after backup. Generally, perform a normal backup when creating the backup set for the first time.
Incremental Backup (Incremental): Only files and folders selected for backup and marked are cleared. That is, only files created or changed since the last normal backup or Incremental Backup are backed up. It requires the least storage space and saves backup time. However, it is time-consuming and difficult to restore files.
Differential backup (Differential): Only the files and folders selected for backup with the logo are not cleared. That is, only files created or changed since the last normal backup or Incremental Backup are backed up. Because it does not clear the archive attributes of files, if two differential backups are performed on a file, the entire file will be backed up at each time. Differential backup uses more storage media than Incremental backup, but restoring differential backup data is simpler.
Dump
1. dump is a backup and recovery tool provided by the Linux system. It is provided in various versions (log files are not provided ).
2. dump stores Incremental backup of the file system, which can be backed up to tape, disk, or a disk file.
File backup
Full file system backup or Incremental Backup
A file backup changed after the specified date
File backup changed after the last backup
3. Command Format:
Dump level unbdsf blkg-factor density size device-name file_system
Level: Backup level, 0 ~ 9
B: factor
U: update the dumpdates file (/etc/dumpdates)
N: Notify the operating system member group when dump is complete.
D and s: backup volume size
F: The specified backup device.
W and W: obtain the information of the file system to be backed up by air transport
Restore
1. Used to check dump created by the dump program to restore a new file or the entire file system
2. Command Format:
Restore [-ctrox] vbsfy blocking-factor file-number device-name
C: Restore all
T: displays the volume content table.
R: indicates that the entire volume content should be restored to the current working directory.
O: overwrite the original file
X: extract the restored file name and path name.
I: allow interactive recovery
Disadvantages of dump and restore
1. When running dump, the file system must be inactive.
2. dump sometimes cannot handle open files and other problems.
Cpio
1. backup and recovery of files or file systems through copying
Cpio? O create a backup
Cpio? I. Recovering from backup
Cpio? P: copy a file from one file system to another.
Cpio recovery
1. Operation
Full recovery and partial recovery
Restore to the current directory or File System
Restore with pattern matching
Interactive recovery
Read File Content table
Tar
1. Backup: tar cvfb [pattern]
2. Restore: tar mopxvf device pattern
Dd
1. Copy files or raw data for backup.
2. Data Stream operations are implemented through pipelines. During transmission, the copied content is converted from one format to another.
3. With the help of pipelines, you can complete standard input to standard input, and implement data flow from one command to another command, from one system to another.
Tar, cpio, dd
Differences between tar, cpio, and dump
1. dump writes a content table at the beginning of each volume. When it is restored using restore, the index will be read, you can run the cd and ls commands on the index to view and select the files to be restored.
2. dump supports remote device backup, but cpio does not.
3. tar and cpio can access files through the file system, regardless of the file system.