实验题·xfs文件恢复===」需要事先做好文件备份

实验题·ext文件恢复

实验环境

CentOS 7.6

需求分析

挂载一个新的磁盘来实现xfs文件恢复

实验步骤

[root@localhost ~]# fdisk /dev/sdb #进行分区

[root@localhost ~]# mkfs.xfs /dev/sdb1 #格式化成xfs格式的磁盘

[root@localhost ~]# mount /dev/sdb1 /opt #挂载磁盘

[root@localhost ~]# cd /opt #进入目录里面创建一些文件来进行模拟实验

[root@localhost ~]# yum-y install xfsdump #安装一下对应的软件

[root@localhost ~]# xfsdump -f /mnt/xfs.bak /dev/sdb1
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)
 -> xfs.bak
session label entered: "xfs.bak"

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

xfsdump: level 0 dump of localhost.localdomain:/opt
xfsdump: dump date: Sat Jul  4 15:01:45 2020
xfsdump: session id: bbb69541-f6dd-4b0e-9122-e7f788853fca
xfsdump: session label: "xfs.bak"
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: 21760 bytes
xfsdump: /var/lib/xfsdump/inventory created

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

please enter label for media in drive 0 (timeout in 300 sec)
 -> sdb1
media label entered: "sdb1"

 --------------------------------- 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 22952 bytes
xfsdump: dump size (non-dir files) : 0 bytes
xfsdump: dump complete: 44 seconds elapsed
xfsdump: Dump Summary:
xfsdump:   stream 0 /mnt/xfs.bak OK (success)
xfsdump: Dump Status: SUCCESS

[root@localhost ~]# rm -rf /opt/* #模拟删除/opt目录下的文件
[root@localhost ~]# xfsrestore -f /mnt/xfs.bak /opt #进行恢复

你可能感兴趣的:(linux系统管理·实验题)