当前位置:网站首页>centos7下xfs文件系统的备份和恢复:完全备份,增量备份,差异备份

centos7下xfs文件系统的备份和恢复:完全备份,增量备份,差异备份

2020-11-10 11:31:11 人生的哲理

一.关于xfs文件系统

​ XfS文件系统是SGI开发的高级日志文件系统,XFS极具伸缩性,非常健壮。centos7选择xfs格式作为默认文件系统,而且不再使用以前

的ext,仍然支持ext4,xfs专为大数据产生,每个单个文件系统最大可以支持8eb,单个文件可以支持16tb,不仅数据量大,而且扩展性

高。

​ XfS文件系统可以通过xfsdump,xfsrestore来进行文件的备份和恢复。xfsdump 按inode顺序备份一个XFS文件系统。与传统的UNIX

文件系统不同,XFS不需要在备份前被卸载;对使用中的XFS文件系统做备份就可以保证镜像的一致性。XFS的备份和恢复的过程是可以被

中断然后继续的,无须冻结文件系统。xfsdump 甚至提供了高性能的多线程备份操作(它把一次dump拆分成多个数据流,每个数据流可

以被发往不同的目的地)。

二.xfsdump的备份级别和注意事项

1.首先介绍一下各种文件备份的定义:

  • 完全备份:每次都把指定的备份目录完整的复制一遍,不管目录下的文件有没有变化;
  • 增量备份:每次将之前(第一次、第二次、直到前一次)做过备份之后有变化的文件进行备份;
  • 差异备份:每次都将第一次完整备份以来有变化的文件进行备份。

2.xfsdump作为文件备份工具,备份级别有两种(备份级别使用数字表示),默认为0(即完全备份)

  • 0级别代表完全备份
  • 1到9级别代表增量备份

3.xfsdump的限制

  • ​ xfsdump 不支持没有挂载的文件系统备份,所以只能备份已挂载的;
  • ​ xfsdump 必须使用 root 的权限才能操作 (涉及文件系统的关系);
  • ​ xfsdump 只能备份 XFS 文件系统;
  • ​ xfsdump 备份下来的数据 (档案或储存媒体) 只能让 xfsrestore 解析;
  • ​ xfsdump 是透过文件系统的 UUID 来分辨各个备份文档的,因此不能备份两个具有相同 UUID 的文件系统。

三.完全备份整个目录/分区,然后恢复数据

1.首先需要进行环境准备,添加一块硬盘,然后对硬盘进行分区,格式化分区,对分区进行挂载。如果对于以上步骤不了解,请查看14章磁盘分区工具。

2.准备需要备份的文件

[root@node5 ~]# df -hT
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs        17G   11G  6.1G  65% /
devtmpfs                devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                   tmpfs     3.9G  8.0K  3.9G   1% /dev/shm
tmpfs                   tmpfs     3.9G  8.8M  3.9G   1% /run
tmpfs                   tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1               xfs      1014M  125M  890M  13% /boot
tmpfs                   tmpfs     785M     0  785M   0% /run/user/0
/dev/sdb1               xfs        47M  2.7M   45M   6% /sdb1
/dev/sdb5               ext4      190M  1.6M  175M   1% /sdb5
/dev/sdb6               xfs       295M   16M  280M   6% /sdb6

#我们可以看出/dev/sdb6分区已经挂载,并且文件系统是xfs文件系统,我们在/sdb6目录下创建文件,并进行备份,然后恢复数据
[root@node5 ~]# cd /sdb6
[root@node5 sdb6]# cp /etc/shadow ./
[root@node5 sdb6]# mkdir -p a/b/c
[root@node5 sdb6]# touch a/test.txt
[root@node5 sdb6]# touch a/b/c/test2.txt

#使用tree命令可以可视化的查看/sdb6目录结构
[root@node5 sdb6]# tree /sdb6
/sdb6
├── a
│   ├── b
│   │   └── c
│   │       └── test2.txt
│   └── test.txt
└── shadow

3 directories, 3 files

3.备份整个分区,命令格式为:xfsdump -f 备份存放位置 要备份路径或设备文件,注意:备份的路径这里不能写成/sdb6/。 可以是/dev/sdb6 或/sdb6

[root@node5 sdb6]# xfsdump -f /opt/xfsdump_sdb6 /dev/sdb6
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.7 (dump format 3.0) - type ^C for status and control

 ============================= dump label dialog ==============================

please enter label for this dump session (timeout in 300 sec)
 -> xfsdump_sdb6                     #指定备份会话标签
session label entered: "xfsdump_sdb6"

 --------------------------------- end dialog ---------------------------------

xfsdump: level 0 dump of node5:/sdb6
xfsdump: dump date: Fri Oct  9 16:40:43 2020
xfsdump: session id: 25353460-0aac-41c4-9f8e-525ca1ec99d1
xfsdump: session label: "xfsdump_sdb6"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: skipping (no pruning necessary)
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 26816 bytes

 ============================= media label dialog =============================

please enter label for media in drive 0 (timeout in 300 sec)
 -> sdb6                           #指定设备标签,就是对要备份的设备做一个描述
media label entered: "sdb6"

 --------------------------------- end dialog ---------------------------------

xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 23944 bytes
xfsdump: dump size (non-dir files) : 1056 bytes
xfsdump: dump complete: 38 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /opt/xfsdump_sdb6 OK (success)
xfsdump: Dump Status: SUCCESS

#此时整个/sdb6 目录备份成功
[root@node5 sdb6]# ls /opt/ -l
total 24
drwxr-xr-x 10 root root   174 May  7  2019 apache-tomcat-8.0.51
drwxr-xr-x 11 root root   151 Apr 22 16:38 nginx
-rw-r--r--  1 root root 23944 Oct  9 16:41 xfsdump_sdb6


#注意如上方式使用交互式方式备份目录,但是如果需要进行定时备份,则需要使用免交互备份方式。
#下面介绍备份/sdb6目录的免交互备份命令
[root@node5 sdb6]# xfsdump -f /opt/xfsdump_sdb6 /dev/sdb6 -L xfsdump_sdb6 -M sdb6
-L:xfsdump记录每次备份的 session 标头,这里可以填写针对此文件系统的简易说明
-M:xfsdump可以记录储存媒体的标头,这里可以填写此媒体的简易说明

4.查看备份信息和内容,备份成功后,我们就可以在/var/lib/xfsdump/inventory目录下看到生成的档案信息

[root@node5 sdb6]# ls /var/lib/xfsdump/inventory/ -l
total 28
-rw-r--r-- 1 root root 5080 Mar 19  2020 0a395bbd-7471-4f81-b6d8-88de226f5380.StObj
-rw-r--r-- 1 root root  312 Oct  9 16:48 457d31a7-28d8-424d-87fe-cca3fe9b907c.InvIndex
-rw-r--r-- 1 root root 5760 Oct  9 16:48 4800a3be-1de7-4017-992f-1360553ccb05.StObj
-rw-r--r-- 1 root root  312 Mar 19  2020 94396e17-4821-4957-aa76-d41f33958ff5.InvIndex
-rw-r--r-- 1 root root 1120 Oct  9 16:41 fstab

[root@node5 sdb6]# xfsdump -I
file system 1:
	fs id:		457d31a7-28d8-424d-87fe-cca3fe9b907c
	session 0:
		mount point:	node5:/sdb6
		device:		node5:/dev/sdb6
		time:		Fri Oct  9 16:40:43 2020
		session label:	"xfsdump_sdb6"
		session id:	25353460-0aac-41c4-9f8e-525ca1ec99d1
		level:		0
		resumed:	NO
		subtree:	NO
		streams:	1
		stream 0:
			pathname:	/opt/xfsdump_sdb6
			start:		ino 67 offset 0
			end:		ino 531202 offset 0
			interrupted:	NO
			media files:	1
			media file 0:
				mfile index:	0
				mfile type:	data
				mfile size:	23944
				mfile start:	ino 67 offset 0
				mfile end:	ino 531202 offset 0
				media label:	"sdb6"
				media id:	a2e68e3c-32e4-4bef-8af7-0b3162891184
xfsdump: Dump Status: SUCCESS

5.删除/sdb6目录的文件并恢复数据

#首先删除/sdb6目录的所有数据
[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
a  shadow
[root@node5 sdb6]# 
[root@node5 sdb6]# rm -rf ./*
[root@node5 sdb6]# ls

#现在所有数据都被删除,开始恢复数据
#恢复数据的命令为:xfsrestore -f 指定恢复文件的位置 指定存放恢复后的文件的路径
[root@node5 sdb6]# xfsrestore -f /opt/xfsdump_sdb6 /sdb6
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description: 
xfsrestore: hostname: node5
xfsrestore: mount point: /sdb6
xfsrestore: volume: /dev/sdb6
xfsrestore: session time: Fri Oct  9 16:40:43 2020
xfsrestore: level: 0
xfsrestore: session label: "xfsdump_sdb6"
xfsrestore: media label: "sdb6"
xfsrestore: file system id: 457d31a7-28d8-424d-87fe-cca3fe9b907c
xfsrestore: session id: 25353460-0aac-41c4-9f8e-525ca1ec99d1
xfsrestore: media id: a2e68e3c-32e4-4bef-8af7-0b3162891184
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 4 directories and 6 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore:   stream 0 /opt/xfsdump_sdb6 OK (success)
xfsrestore: Restore Status: SUCCESS

[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
a  shadow

[root@node5 sdb6]# tree /sdb6
/sdb6
├── a
│   ├── b
│   │   └── c
│   │       └── test2.txt
│   └── test.txt
└── shadow

3 directories, 3 files

#可以看到数据恢复如初

四.完全备份分区中某个目录,然后恢复某个文件/文件夹

1.只备份/sdb6目录下的shadow文件

#还是这个测试目录,但是只备份shadow文件
[root@node5 ~]# cd /sdb6
[root@node5 sdb6]# cp /etc/shadow ./
[root@node5 sdb6]# mkdir -p a/b/c
[root@node5 sdb6]# 
[root@node5 sdb6]# touch a/test.txt
[root@node5 sdb6]# touch a/b/c/test2.txt
[root@node5 sdb6]# 
[root@node5 sdb6]# tree /sdb6
/sdb6
├── a
│   ├── b
│   │   └── c
│   │       └── test2.txt
│   └── test.txt
└── shadow

3 directories, 3 files

#参数:-s 文件路径  只对指定的文件进行备份,-s指定时,路径写的是相对路径(-s可以是文件或目录)
[root@node5 sdb6]# xfsdump -f /opt/xfsdump_shadow -s shadow /sdb6 -L xfsdump_shadow -M sdb6_shadow
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsdump: level 0 dump of node5:/sdb6
xfsdump: dump date: Fri Oct  9 16:48:08 2020
xfsdump: session id: 8dfa7afd-4d05-48ca-8c77-24fca922acab
xfsdump: session label: "xfsdump_shadow"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: skipping (no pruning necessary)
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 25216 bytes
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 22416 bytes
xfsdump: dump size (non-dir files) : 1056 bytes
xfsdump: dump complete: 0 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /opt/xfsdump_shadow OK (success)
xfsdump: Dump Status: SUCCESS
[root@node5 sdb6]# 
[root@node5 sdb6]# ls /opt/
apache-tomcat-8.0.51  nginx  xfsdump_sdb6  xfsdump_shadow

#查看备份信息与内容
[root@node5 sdb6]# xfsdump -I
file system 1:
	fs id:		457d31a7-28d8-424d-87fe-cca3fe9b907c
	session 1:
		mount point:	node5:/sdb6
		device:		node5:/dev/sdb6
		time:		Fri Oct  9 16:48:08 2020
		session label:	"xfsdump_shadow"
		session id:	8dfa7afd-4d05-48ca-8c77-24fca922acab
		level:		0
		resumed:	NO
		subtree:	YES
		streams:	1
		stream 0:
			pathname:	/opt/xfsdump_shadow
			start:		ino 67 offset 0
			end:		ino 68 offset 0
			interrupted:	NO
			media files:	1
			media file 0:
				mfile index:	0
				mfile type:	data
				mfile size:	22416
				mfile start:	ino 67 offset 0
				mfile end:	ino 68 offset 0
				media label:	"sdb6_shadow"
				media id:	067e94a9-6b90-483d-b531-ebe6c1b49fd5
xfsdump: Dump Status: SUCCESS

2.删除数据,然后恢复指定文件

#删除数据
[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
a  shadow
[root@node5 sdb6]# rm -rf ./*
[root@node5 sdb6]# ls

#语法:xfsrestore -f 指定恢复文件的位置 指定存放恢复后的文件的路径
#-s指定需要恢复的单个文件或者目录
[root@node5 sdb6]# xfsrestore -f /opt/xfsdump_shadow -s shadow /sdb6
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description: 
xfsrestore: hostname: node5
xfsrestore: mount point: /sdb6
xfsrestore: volume: /dev/sdb6
xfsrestore: session time: Fri Oct  9 16:48:08 2020
xfsrestore: level: 0
xfsrestore: session label: "xfsdump_shadow"
xfsrestore: media label: "sdb6_shadow"
xfsrestore: file system id: 457d31a7-28d8-424d-87fe-cca3fe9b907c
xfsrestore: session id: 8dfa7afd-4d05-48ca-8c77-24fca922acab
xfsrestore: media id: 067e94a9-6b90-483d-b531-ebe6c1b49fd5
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 1 directories and 2 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore:   stream 0 /opt/xfsdump_shadow OK (success)
xfsrestore: Restore Status: SUCCESS

#查看目录,发现只恢复了指定文件
[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
shadow

五.增量备份

1.增量备份是指在一次完全备份或上一次增量备份后,以后每次的备份只需备份与前一次相比增加或者被修改的文件。这就意味着,第一

次增量备份的对象是进行全备后所产生的增加和修改的文件;第二次增量备份的对象是进行第一次增量备份后所产生的增加和修改的文

件,以此类推。

  • 优点:没有重复的备份数据,因此备份的数据量不大,备份所需的时间很短。
  • 缺点:数据恢复相对比较麻烦,它需要上一次全备份和所有增量备份的内容才能够完全恢复成功,并且它们必须沿着从全备份到依次增量备份的时间顺序逐个反推恢复,因此可能会延长恢复时间

2.准备测试文件,进行第一次完全备份

[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
grub  profile.d  shadow
[root@node5 sdb6]# 
[root@node5 sdb6]# tree ./
./
├── grub
│   └── splash.xpm.gz
├── profile.d
│   ├── 256term.csh
│   ├── 256term.sh
│   ├── colorgrep.csh
│   ├── colorgrep.sh
│   ├── colorls.csh
│   ├── colorls.sh
│   ├── jdk8.sh
│   ├── lang.csh
│   ├── lang.sh
│   ├── less.csh
│   ├── less.sh
│   ├── vim.csh
│   ├── vim.sh
│   ├── which2.csh
│   └── which2.sh
└── shadow

2 directories, 17 files
[root@node5 sdb6]# xfsdump -f /opt/sdb6_fulldump /sdb6 -L fulldump -M sdb6
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsdump: level 0 dump of node5:/sdb6
xfsdump: dump date: Sat Oct 10 01:02:56 2020
xfsdump: session id: b28b76f0-752c-423b-82d2-83d999e0d477
xfsdump: session label: "fulldump"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: skipping (no pruning necessary)
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 96512 bytes
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 46048 bytes
xfsdump: dump size (non-dir files) : 18976 bytes
xfsdump: dump complete: 0 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /opt/sdb6_fulldump OK (success)
xfsdump: Dump Status: SUCCESS
[root@node5 sdb6]# 
[root@node5 sdb6]# 
[root@node5 sdb6]# ls /opt/sdb6_fulldump -l
-rw-r--r-- 1 root root 46048 Oct 10 01:02 /opt/sdb6_fulldump

3.增加内容,进行第一次增量备份

[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
grub  profile.d  shadow

[root@node5 sdb6]# cp /etc/profile ./
[root@node5 sdb6]# ls
grub  profile  profile.d  shadow

#-l <level>  做一个等级为1的增量备份
[root@node5 sdb6]# xfsdump -l 1 -f /opt/sdb6_incredump1 /sdb6 -L incredump1 -M sdb6
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsdump: level 1 incremental dump of node5:/sdb6 based on level 0 dump begun Sat Oct 10 01:02:56 2020
xfsdump: dump date: Sat Oct 10 01:06:44 2020
xfsdump: session id: c8e103f5-916a-41d4-8c5a-05522527c40f
xfsdump: session label: "incredump1"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: pruning unneeded subtrees
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 25216 bytes
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 23504 bytes
xfsdump: dump size (non-dir files) : 2080 bytes
xfsdump: dump complete: 0 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /opt/sdb6_incredump1 OK (success)
xfsdump: Dump Status: SUCCESS

4.继续增加数据,进行第二次增量备份

[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
grub  profile  profile.d  shadow

[root@node5 sdb6]# mkdir -p a/b/c/d/e/f
[root@node5 sdb6]# touch a/b/c/test.txt

#进行level 2级别的增量备份
[root@node5 sdb6]# xfsdump -l 2 -f /opt/sdb6_incredump2 /sdb6 -L incredump2 -M sdb6
xfsdump: using file dump (drive_simple) strategy
xfsdump: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsdump: level 2 incremental dump of node5:/sdb6 based on level 1 dump begun Sat Oct 10 01:06:44 2020
xfsdump: dump date: Sat Oct 10 01:09:15 2020
xfsdump: session id: 6b0720e5-8c37-4284-877f-ba3b3d29013f
xfsdump: session label: "incredump2"
xfsdump: ino map phase 1: constructing initial dump list
xfsdump: ino map phase 2: pruning unneeded subtrees
xfsdump: ino map phase 3: skipping (only one dump stream)
xfsdump: ino map construction complete
xfsdump: estimated dump size: 23040 bytes
xfsdump: creating dump session media file 0 (media 0, file 0)
xfsdump: dumping ino map
xfsdump: dumping directories
xfsdump: dumping non-directory files
xfsdump: ending media file
xfsdump: media file size 23280 bytes
xfsdump: dump size (non-dir files) : 0 bytes
xfsdump: dump complete: 0 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /opt/sdb6_incredump2 OK (success)
xfsdump: Dump Status: SUCCESS

5.删除数据,然后进行数据恢复

[root@node5 sdb6]# pwd
/sdb6
[root@node5 sdb6]# ls
a  grub  profile  profile.d  shadow
[root@node5 sdb6]# 
[root@node5 sdb6]# rm -rf ./*
[root@node5 sdb6]# ls

#恢复数据的思路:
#先恢复完全备份    
#情况1: 恢复最后一次增量备份(如果两次增量备份都是1级的,所以只需要恢复最后一个增量就可以了。
#情况2:如果你做的是第一次是1级备,第二次是2级备,那么你在恢复的时候就需要先恢复完全备份,然后是1级备,最后是2级备)

#先恢复完全备份    
[root@node5 sdb6]# xfsrestore -f /opt/sdb6_fulldump /sdb6
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description: 
xfsrestore: hostname: node5
xfsrestore: mount point: /sdb6
xfsrestore: volume: /dev/sdb6
xfsrestore: session time: Sat Oct 10 01:02:56 2020
xfsrestore: level: 0
xfsrestore: session label: "fulldump"
xfsrestore: media label: "sdb6"
xfsrestore: file system id: 457d31a7-28d8-424d-87fe-cca3fe9b907c
xfsrestore: session id: b28b76f0-752c-423b-82d2-83d999e0d477
xfsrestore: media id: 782599f6-9d7b-4f94-ba01-91aa73a11d76
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 3 directories and 19 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore:   stream 0 /opt/sdb6_fulldump OK (success)
xfsrestore: Restore Status: SUCCESS

[root@node5 sdb6]# ls
grub  profile.d  shadow

#接着恢复一级增量备份
[root@node5 sdb6]# xfsrestore -f /opt/sdb6_incredump1 /sdb6
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description: 
xfsrestore: hostname: node5
xfsrestore: mount point: /sdb6
xfsrestore: volume: /dev/sdb6
xfsrestore: session time: Sat Oct 10 01:06:44 2020
xfsrestore: level: 1
xfsrestore: session label: "incredump1"
xfsrestore: media label: "sdb6"
xfsrestore: file system id: 457d31a7-28d8-424d-87fe-cca3fe9b907c
xfsrestore: session id: c8e103f5-916a-41d4-8c5a-05522527c40f
xfsrestore: media id: 4434fdb4-513c-43aa-b31d-35560f818b5c
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 1 directories and 4 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore:   stream 0 /opt/sdb6_incredump1 OK (success)
xfsrestore: Restore Status: SUCCESS

[root@node5 sdb6]# ls
grub  profile  profile.d  shadow

#最后恢复二级增量备份
[root@node5 sdb6]# xfsrestore -f /opt/sdb6_incredump2 /sdb6
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.7 (dump format 3.0) - type ^C for status and control
xfsrestore: searching media for dump
xfsrestore: examining media file 0
xfsrestore: dump description: 
xfsrestore: hostname: node5
xfsrestore: mount point: /sdb6
xfsrestore: volume: /dev/sdb6
xfsrestore: session time: Sat Oct 10 01:09:15 2020
xfsrestore: level: 2
xfsrestore: session label: "incredump2"
xfsrestore: media label: "sdb6"
xfsrestore: file system id: 457d31a7-28d8-424d-87fe-cca3fe9b907c
xfsrestore: session id: 6b0720e5-8c37-4284-877f-ba3b3d29013f
xfsrestore: media id: 9012fd55-692a-44fa-9d60-83d478555852
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: reading directories
xfsrestore: 7 directories and 11 entries processed
xfsrestore: directory post-processing
xfsrestore: restoring non-directory files
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: Restore Summary:
xfsrestore:   stream 0 /opt/sdb6_incredump2 OK (success)
xfsrestore: Restore Status: SUCCESS
[root@node5 sdb6]# ls
a  grub  profile  profile.d  shadow

可以看到数据被依次恢复如初。

版权声明
本文为[人生的哲理]所创,转载请带上原文链接,感谢
https://www.cnblogs.com/renshengdezheli/p/13952829.html