[root@node83 ~]# yum install dump -y
dump [option] dstname <file | dir>
-level# 指定備份級別0-9
-f filename 指定備份文件名
-u 備份成功後,在/etc/dumpdates中記錄備份時間
-v 詳細輸出
-j bzip壓縮.bz2
-W 顯示容許被dump的分區的備份等級及備份時間
分區級備份
[root@node83 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 5916420 2057324 3551896 37% /
tmpfs 502384 0 502384 0% /dev/shm
/dev/sda1 194241 35987 148014 20% /boot
[root@node83 ~]# cat /etc/dumpdates
/dev/sda1 0 Tue Jun 6 10:46:02 2017 +0800
[root@node83 ~]# dump -1uj -f /tmp/boot1.bak.bz2 /boot #增量備份
[root@node83 ~]# ls -l /tmp/
total 32164
-rw-r--r-- 1 root root 11112 Jun 6 10:52 boot1.bak.bz2
-rw-r--r-- 1 root root 32916328 Jun 6 10:46 boot.bak.bz2
[root@node83 ~]# dump -W
Last dump(s) done (Dump '>' file systems):
> /dev/sda2 ( /) Last dump: never
/dev/sda1 ( /boot) Last dump: Level 1, Date Tue Jun 6 10:52:46 2017
目錄或文件級備份
對於目錄或文件,只能只用0級別進行完整備份,不支持增量備份
restore [模式選項] [選項] 經常使用模式選項 -C 比較備份數據和實際數據的變化 -i 進入交互模式,手工選擇須要恢復的文件 -t 查看模式,用於查看備份文件中擁有哪些數據 -r 還原模式,用於數據還原 選項 -f 指定備份文件的文件名
對於完整備份/tmp/boot1.bak.bz2,其備份/boot下有文件更名
使用
[root@node83 ~]# restore -C /tmp/boot.bak.bz2
會提示找不到某文件
查看備份文件內容
[root@node83 ~]# restore -tf /tmp/boot.bak.bz2
查看增量備分內容
[root@node83 ~]# restore -tf /tmp/boot1.bak.bz2
Dump tape is compressed.
Dump date: Tue Jun 6 10:52:46 2017
Dumped from: Tue Jun 6 10:46:02 2017
Level 1 dump of /boot on node83:/dev/sda1
Label: none
2 .
39 ./hosts
還原步驟
[root@node83 ~]# mkdir /boottest 建立目錄
[root@node83 ~]# cd /boottest/ 並進入
[root@node83 boottest]# restore -rf /tmp/boot.bak.bz2 還原徹底備份
Dump tape is compressed.
[root@node83 boottest]# ls
config-2.6.32-573.el6.x86_64 initramfs-2.6.32-573.el6.x86_64.img symvers-2.6.32-573.el6.x86_64.gz
efi lost+found System.map-2.6.32-573.el6.x86_64
grub restoresymtable vmlinuz-2.6.32-573.el6.x86_64
[root@node83 boottest]# restore -rf /tmp/boot1.bak.bz2 還原增量備份
Dump tape is compressed.
[root@node83 boottest]# ls
config-2.6.32-573.el6.x86_64 initramfs-2.6.32-573.el6.x86_64.img System.map-2.6.32-573.el6.x86_64
efi lost+found vmlinuz-2.6.32-573.el6.x86_64
grub restoresymtable
hosts symvers-2.6.32-573.el6.x86_64.gz