Data backup--dump (this author has many useful blog posts)

Source: Internet
Author: User

Data centers operate large amounts of data. It was a disaster when it was destroyed. This time need backup to restore, in time you have a large number of backup data is useless, backup is certainly not a waste. You may be lucky that you have never experienced data loss. However, because it is very rare and it is important to maintain the integrity of the data, it seems to be no problem to "save time" and resources by skipping backups. But data center backup is important, and it practitioners believe in the value of backup and do their best to make appropriate backups.

Full backup

A full backup is a complete backup of the business data. For example, in Monday, a tape was used to back up the entire business system, and Tuesday was backed up with the entire business system of another tape team.

The advantage is that when data is lost, all lost data can be recovered with just one tape.

The disadvantage is: due to daily data full backup, will cause a lot of data duplication, occupy a lot of tape space, increase the cost of backup, if the amount of data is large, then the backup time will be longer.

Incremental backup

Incremental backup means that after a full backup or a previous incremental backup, each subsequent backup is only required to back up the files that were added and modified by the previous one. This means that the object of the first incremental backup is the addition and modification of the file that is produced after the full preparation; The object of the second incremental backup is the addition and modification of the file resulting from the first incremental backup.

The advantage is that there is no duplicate backup data, so the amount of data backed up is small and the backup takes a short time.

The downside is that data recovery for incremental backups is cumbersome. You must have a previous full backup and all incremental backup tapes (which can cause recovery failures if one of the tapes is lost or damaged), and they must be reversed back-to-back in chronological order from full backup to incremental backup, so this greatly prolongs recovery time.

A differential backup is a fully-benchmarked way of backing up. For example, the system administrator makes a full backup of the system in Sunday, Monday backs up data from Sunday to Monday, and Tuesday backs up data between Sunday and Tuesday, and so on.

The advantages are: avoid the defects of the above two backup strategies, but also have the advantages of both. There is no need to do a full backup of the system every day, so the amount of backup data is small, backup time is short, and can save disk space, second, it is convenient to recover data, only need two backup, that is, full backup and the day before the disaster to backup.

Dump Backup

Advantages of using Dump backup

1, backup can span multi-volume tape;

2, Backup can be any type of file, even can be a device

3, Backup, the permissions of the file, belong to the main, group, modification time will be saved;

4, can correctly handle the file block that never contains any data;

5, can do incremental, differential backup.

Install dump

[email protected] ~]# Yum install-y dump

Basic usage of Dump

Dump-level-u-F Backup File name object to be backed up

Level represents the levels of backup, 0 represents a full backup, 1 represents the difference portion of the current and 0 comparisons, and 2 represents the difference portion of the current and 1 comparisons. The backup file system can use a level of 0-9, while the backup folder can only use 0. If you do an incremental backup every day, select level 0 To do a full backup, and then use the same level of more than 0 per day, and 1 is used all the time.

-U logs the time of the backup to the/etc/dumpuodates file, if you want to use an incremental or differential backup scheme, be sure to use the-u option if the backup folder cannot use the U option

-f Specifies the file that the backup generates

-j or-Z compression backup

Full backup

Dump-0u-f/tmp/baskup/full.dmp/tmp/test

Incremental backup

Dump-1u-f/tmp/backup/add_001.dmp/tmp/test

Dump-2u-f/tmp/backup/add_002.dmp/tmp/test

View files and restore commands in a backup document restore

-T view the contents of the backup file

-R view or restore the entire file system

-F Backup files to view or restore

[Email protected] test]# dump-0u-f/test/boot.dump/boot
Dump:date of this level 0 Dump:tue Oct 8 08:57:45 2013
DUMP:DUMPING/DEV/VDA1 (/boot) to/test/boot.dump
DUMP:Label:none
........................
Dump:volume 1 Transfer rate:18880 kb/s
dump:18880 blocks (18.44MB) on 1 volume (s)
Dump:finished in 1 seconds, throughput 18880 kbytes/sec
Dump:date of this level 0 Dump:tue Oct 8 08:57:45 2013
Dump:date This dump Completed:tue Oct 8 08:57:46 2013
Dump:average Transfer rate:18880 kb/s
Dump:dump is done

[Email protected] test]# cd/etc/

[email protected] etc]# CP passwd shadow/boot/
[Email protected] etc]# cd/boot/
[[email protected] boot]# ls
Config-2.6.32-71.el6.x86_64
Efi
Grub
Initramfs-2.6.32-71.el6.x86_64.img
Lost+found
passwd
Shadow
Symvers-2.6.32-71.el6.x86_64.gz
System.map-2.6.32-71.el6.x86_64
Vmlinuz-2.6.32-71.el6.x86_64

[Email protected] boot]# dump-u1-f/test/add_001.dump/boot

Create a few more files and then continue the backup

[email protected] boot]# Touch test1
[email protected] boot]# Touch test2
[email protected] boot]# Touch test3
[email protected] boot]# Touch test4
[email protected] boot]# Touch TEST5
[[email protected] boot]# ls
Config-2.6.32-71.el6.x86_64
Efi
Grub
Initramfs-2.6.32-71.el6.x86_64.img
Lost+found
passwd
Shadow
Symvers-2.6.32-71.el6.x86_64.gz
System.map-2.6.32-71.el6.x86_64
Test1
Test2
Test3
Test4
Test5
Vmlinuz-2.6.32-71.el6.x86_64

[Email protected] boot]# dump-u2-f/test/add_002.dump/boot

[Email protected] boot]# cd/test/
[[email protected] test]# ls
Add_001.dump Add_002.dump Boot.dump

Use the command restore to view the contents of the backup file

[Email protected] test]# Restore-tf/test/boot.dump
Dump date:tue Oct 8 08:57:45 2013
Dumped from:the Epoch
Level 0 Dump Of/boot on LOCALHOST.LOCALDOMAIN:/DEV/VDA1
Label:none
2.
/lost+found.
65025./grub
65031./grub/grub.conf
65026./grub/splash.xpm.gz
65032./grub/menu.lst
65033./grub/device.map
65034./grub/stage1
65035./grub/stage2
65036./grub/e2fs_stage1_5
65037./grub/fat_stage1_5
65038./grub/ffs_stage1_5
65039./grub/iso9660_stage1_5
65040./grub/jfs_stage1_5
65041./grub/minix_stage1_5
65042./grub/reiserfs_stage1_5
65043./grub/ufs2_stage1_5
65044./grub/vstafs_stage1_5
65045./grub/xfs_stage1_5
65027./efi
65028./efi/efi
65029./efi/efi/redhat
65030./efi/efi/redhat/grub.efi
/.vmlinuz-2.6.32-71.el6.x86_64.hmac.
/system.map-2.6.32-71.el6.x86_64.
/config-2.6.32-71.el6.x86_64.
/symvers-2.6.32-71.el6.x86_64.gz.
/vmlinuz-2.6.32-71.el6.x86_64.
/initramfs-2.6.32-71.el6.x86_64.img.

[Email protected] test]# Restore-tf/test/add_001.dump
Dump date:tue Oct 8 09:00:42 2013
Dumped from:tue Oct 8 08:57:45 2013
Level 1 dump Of/boot on LOCALHOST.LOCALDOMAIN:/DEV/VDA1
Label:none
2.
/PASSWD.
/shadow.

[[email protected] test]# Restore-tf/test/add_002.dump View the contents of an incremental backup
Dump date:tue Oct 8 09:02:58 2013
Dumped from:tue Oct 8 09:00:42 2013
Level 2 dump Of/boot on LOCALHOST.LOCALDOMAIN:/DEV/VDA1
Label:none
2.
/test1.
/test2.
/test3.
/test4.
/test5.

Now I'm going to remove everything under my/boot/and try to restore it.

[[email protected] test]# rm-rf/boot/* Delete all Files
[Email protected] test]# cd/boot/
[[email protected] boot]# ls
[Email protected] boot]#

Recovering data

[[email protected] boot]# restore-rf/test/boot.dump first restore to full backup
[[email protected] boot]# ls
Config-2.6.32-71.el6.x86_64
Efi
Grub
Initramfs-2.6.32-71.el6.x86_64.img
Lost+found
Restoresymtable
Symvers-2.6.32-71.el6.x86_64.gz
System.map-2.6.32-71.el6.x86_64
Vmlinuz-2.6.32-71.el6.x86_64

[[email protected] boot]# Restore-rf/test/add_001.dump Restore the first incremental backup
[[email protected] boot]# ls
Config-2.6.32-71.el6.x86_64
Efi
Grub
Initramfs-2.6.32-71.el6.x86_64.img
Lost+found
passwd
Restoresymtable
Shadow
Symvers-2.6.32-71.el6.x86_64.gz
System.map-2.6.32-71.el6.x86_64
Vmlinuz-2.6.32-71.el6.x86_64

[[email protected] boot]# Restore-rf/test/add_002.dump Restore the second incremental backup
[[email protected] boot]# ls
Config-2.6.32-71.el6.x86_64
Efi
Grub
Initramfs-2.6.32-71.el6.x86_64.img
Lost+found
passwd
Restoresymtable
Shadow
Symvers-2.6.32-71.el6.x86_64.gz
System.map-2.6.32-71.el6.x86_64
Test1
Test2
Test3
Test4
Test5
Vmlinuz-2.6.32-71.el6.x86_64

This enables the most basic full-volume and incremental backups, although the restore data can also be used to restore some of the files in the backup file, which is the interactive mode of restore

Now I just want to restore the Test2,test3 file in Add_002.dmp

[[email protected] boot]# restore-if/test/add_002.dump------------> Enter interactive mode parameter is if
Restore >? ------------> View the commands you can use in the current mode
Available Commands is:
LS [arg]-list directory
CD Arg-change Directory
Pwd-print current Directory
Add [arg]-add ' arg ' to list of files to be extracted
Delete [arg]-delete ' arg ' from List of files to be extracted
Extract-extract Requested Files
Setmodes-set Modes of requested directories
quit-immediately Exit Program
What-list Dump Header information
Verbose-toggle verbose flag (useful with "LS")
Prompt-toggle the prompt display
Help or '? '-the Print this list
If no ' arg ' is supplied, the current directory is used

Restore > LS---------> List all files that can be recovered
.:
Test1 test2 test3 test4 test5

Restore > Add test2 test3-------------> Add files that need to be recovered
Restore > ls-------------> LS results with * is the file to be recovered
.:
Test1 *test2 *test3 test4 test5

Restore > Extract--------------start recovery
You haven't read any volumes yet.
Unless you know which volume your file (s) is on you should start
With the last volume and work towards the first.
Specify next Volume # (None if no more volumes): 1-----------------means on one disk
Set owner/mode for '. '? [yn] n--------------do not change the permissions of the file
Restore > Quit--------End exit interaction mode
[[Email protected]t boot]# ls
Config-2.6.32-71.el6.x86_64 Shadow
EFI symvers-2.6.32-71.el6.x86_64.gz
Grub SYSTEM.MAP-2.6.32-71.EL6.X86_64
Initramfs-2.6.32-71.el6.x86_64.img test2
Lost+found test3
passwd vmlinuz-2.6.32-71.el6.x86_64
Restoresymtable

The whole process is a complete backup and an example of incremental backup, for your reference

http://blog.csdn.net/avilifans/article/details/12418013

Data backup--dump (this author has many useful blog posts)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.