背景:
阅读新闻
dump和restore命令实现全备、增量备份和差异备份
[日期:2013-08-18] 来源:Linux社区 作者:justdb [字体:]
四 dump和restore——实现增量备份
#增量备份:1-9
#dump:备份磁盘上的块,不止是文件;只能备份单独的分区
[root@serv01 data]# rm -rf *
[root@serv01 data]# cp /boot/* .
cp: omitting directory `/boot/efi'
cp: omitting directory `/boot/grub'
cp: omitting directory `/boot/lost+found'
[root@serv01 data]# cd /backup/
[root@serv01 backup]# ll
total 18672
-rw-r--r--. 1 root root 19118080 Aug 2 2013dump01.dump
[root@serv01 backup]# rm -rf dump01.dump
#第一次备份:全备
[root@serv01 backup]# dump -0uf data01.dump/data/
DUMP: Date of this level 0 dump: Fri Aug 2 11:25:57 2013
DUMP: Dumping /dev/sdb1 (/data) to data01.dump
DUMP: Label: none
DUMP: Writing 10 Kilobyte records
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 18674 blocks.
DUMP: Volume 1 started with block 1 at: Fri Aug 2 11:25:57 2013
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: Closing data01.dump
DUMP: Volume 1 completed at: Fri Aug 2 11:25:57 2013
DUMP: Volume 1 18670 blocks (18.23MB)
DUMP: 18670 blocks (18.23MB) on 1 volume(s)
DUMP: finished in less than a second
DUMP: Date of this level 0 dump: Fri Aug 2 11:25:57 2013
DUMP: Date this dump completed: Fri Aug 2 11:25:57 2013
DUMP: Average transfer rate: 0 kB/s
DUMP: DUMP IS DONE
[root@serv01 backup]# ll
total 18672
-rw-r—r—. 1 root root 19118080 Aug 2 11:25 data01.dump
#拷贝文件到data目录
#第二次备份:增量备份
[root@serv01 backup]# cp /etc/inittab/data/
[root@serv01 backup]# dump -1uf data02.dump/data/
DUMP: Date of this level 1 dump: Fri Aug 2 11:26:28 2013
DUMP: Date of last level 0 dump: Fri Aug 2 11:25:57 2013
DUMP: Dumping /dev/sdb1 (/data) to data02.dump
DUMP: Label: none
DUMP: Writing 10 Kilobyte records
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 55 blocks.
DUMP: Volume 1 started with block 1 at: Fri Aug 2 11:26:28 2013
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: Closing data02.dump
DUMP: Volume 1 completed at: Fri Aug 2 11:26:28 2013
DUMP: Volume 1 50 blocks (0.05MB)
DUMP: 50 blocks (0.05MB) on 1 volume(s)
DUMP: finished in less than a second
DUMP: Date of this level 1 dump: Fri Aug 2 11:26:28 2013
DUMP: Date this dump completed: Fri Aug 2 11:26:28 2013
DUMP: Average transfer rate: 0 kB/s
DUMP: DUMP IS DONE
[root@serv01 backup]# ll
total 18724
-rw-r--r--. 1 root root 19118080 Aug 2 11:25 data01.dump
-rw-r--r—. 1 root root 51200 Aug 2 11:26 data02.dump
#再次拷贝文件
[root@serv01 backup]# cp /etc/passwd /data/
#第三次备份:增量备份
[root@serv01 backup]# dump -2uf data03.dump/data/
DUMP: Date of this level 2 dump: Fri Aug 2 11:27:07 2013
DUMP: Date of last level 1 dump: Fri Aug 2 11:26:28 2013
DUMP: Dumping /dev/sdb1 (/data) to data03.dump
DUMP: Label: none
DUMP: Writing 10 Kilobyte records
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 55 blocks.
DUMP: Volume 1 started with block 1 at: Fri Aug 2 11:27:07 2013
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: Closing data03.dump
DUMP: Volume 1 completed at: Fri Aug 2 11:27:07 2013
DUMP: Volume 1 50 blocks (0.05MB)
DUMP: 50 blocks (0.05MB) on 1 volume(s)
DUMP: finished in less than a second
DUMP: Date of this level 2 dump: Fri Aug 2 11:27:07 2013
DUMP: Date this dump completed: Fri Aug 2 11:27:07 2013
DUMP: Average transfer rate: 0 kB/s
DUMP: DUMP IS DONE
[root@serv01 backup]# cat /etc/dumpdates
/dev/sdb1 0 Fri Aug 2 11:25:57 2013 +0800
/dev/sdb1 1 Fri Aug 2 11:26:28 2013 +0800
/dev/sdb1 2 Fri Aug 2 11:27:07 2013 +0800
#第四次备份:增量备份
[root@serv01 backup]# dump -3uf data04.dump/data/
DUMP: Date of this level 3 dump: Fri Aug 2 11:28:48 2013
DUMP: Date of last level 2 dump: Fri Aug 2 11:27:07 2013
DUMP: Dumping /dev/sdb1 (/data) to data04.dump
DUMP: Label: none
DUMP: Writing 10 Kilobyte records
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 50 blocks.
DUMP: Volume 1 started with block 1 at: Fri Aug 2 11:28:48 2013
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: Closing data04.dump
DUMP: Volume 1 completed at: Fri Aug 2 11:28:48 2013
DUMP: Volume 1 40 blocks (0.04MB)
DUMP: 40 blocks (0.04MB) on 1 volume(s)
DUMP: finished in less than a second
DUMP: Date of this level 3 dump: Fri Aug 2 11:28:48 2013
DUMP: Date this dump completed: Fri Aug 2 11:28:48 2013
DUMP: Average transfer rate: 0 kB/s
DUMP: DUMP IS DONE
[root@serv01 backup]# cat /etc/dumpdates
/dev/sdb1 0 Fri Aug 2 11:25:57 2013 +0800
/dev/sdb1 1 Fri Aug 2 11:26:28 2013 +0800
/dev/sdb1 2 Fri Aug 2 11:27:07 2013 +0800
/dev/sdb1 3 Fri Aug 2 11:28:48 2013 +0800
#进入data目录,模拟数据丢失
[root@serv01 backup]# cd /data
[root@serv01 data]# ls
config-2.6.32-131.0.15.el6.x86_64 inittab symvers-2.6.32-131.0.15.el6.x86_64.gz
initramfs-2.6.32-131.0.15.el6.x86_64.img passwd vmlinuz-2.6.32-131.0.15.el6.x86_64
[root@serv01 data]# rm -rf *
[root@serv01 data]# ls
#恢复数据:一级一级地恢复
[root@serv01 data]# restore -rf/backup/data01.dump
[root@serv01 data]# ls
config-2.6.32-131.0.15.el6.x86_64 restoresymtable System.map-2.6.32-131.0.15.el6.x86_64
initramfs-2.6.32-131.0.15.el6.x86_64.img symvers-2.6.32-131.0.15.el6.x86_64.gz vmlinuz-2.6.32-131.0.15.el6.x86_64
[root@serv01 data]# restore -rf/backup/data03.dump
restore: Incremental tape too low
[root@serv01 data]# ls
config-2.6.32-131.0.15.el6.x86_64 restoresymtable System.map-2.6.32-131.0.15.el6.x86_64
initramfs-2.6.32-131.0.15.el6.x86_64.img symvers-2.6.32-131.0.15.el6.x86_64.gz vmlinuz-2.6.32-131.0.15.el6.x86_64
[root@serv01 data]# restore -rf/backup/data02.dump
[root@serv01 data]# restore -rf/backup/data03.dump
[root@serv01 data]# restore -rf/backup/data04.dump
[root@serv01 data]# ls
config-2.6.32-131.0.15.el6.x86_64 inittab restoresymtable vmlinuz-2.6.32-131.0.15.el6.x86_64
initramfs-2.6.32-131.0.15.el6.x86_64.img passwd symvers-2.6.32-131.0.15.el6.x86_64.gz
#恢复时报错:
#1.恢复的数据不对:查看挂载是否正确
#2.restore: Incremental tape too high 同一级别的备份了多次,所以会报这个错误,检查/etc/dumpdates文件和拼写是否错误
相关资讯
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯