[[email protected] ~]# yum install dump -ydump [option] dstname <file | dir> -level# 指定备份级别0-9 -f filename 指定备份文件名 -u 备份成功后,在/etc/dumpdates中记录备份时间 -v 详细输出 -j bzip压缩.bz2 -W 显示允许被dump的分区的备份等级及备份时间 分区级备份[[email protected] ~]# dfFilesystem 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 [[email protected] ~]# cat /etc/dumpdates /dev/sda1 0 Tue Jun 6 10:46:02 2017 +0800 [[email protected] ~]# dump -1uj -f /tmp/boot1.bak.bz2 /boot #增量备份[[email protected] ~]# 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 [[email protected] ~]# dump -WLast 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下有文件改名使用[[email protected] ~]# restore -C /tmp/boot.bak.bz2 会提示找不到某文件 查看备份文件内容[[email protected] ~]# restore -tf /tmp/boot.bak.bz2 查看增量备份内容[[email protected] ~]# restore -tf /tmp/boot1.bak.bz2 Dump tape is compressed.Dump date: Tue Jun 6 10:52:46 2017Dumped from: Tue Jun 6 10:46:02 2017Level 1 dump of /boot on node83:/dev/sda1Label: none 2 . 39 ./hosts 还原步骤[[email protected] ~]# mkdir /boottest 创建目录[[email protected] ~]# cd /boottest/ 并进入 [[email protected] boottest]# restore -rf /tmp/boot.bak.bz2 还原完全备份Dump tape is compressed.[[email protected] boottest]# lsconfig-2.6.32-573.el6.x86_64 initramfs-2.6.32-573.el6.x86_64.img symvers-2.6.32-573.el6.x86_64.gzefi lost+found System.map-2.6.32-573.el6.x86_64grub restoresymtable vmlinuz-2.6.32-573.el6.x86_64[[email protected] boottest]# restore -rf /tmp/boot1.bak.bz2 还原增量备份Dump tape is compressed.[[email protected] boottest]# lsconfig-2.6.32-573.el6.x86_64 initramfs-2.6.32-573.el6.x86_64.img System.map-2.6.32-573.el6.x86_64efi lost+found vmlinuz-2.6.32-573.el6.x86_64grub restoresymtablehosts symvers-2.6.32-573.el6.x86_64.gz
时间: 2024-10-22 18:02:29