dump和restore命令实现全备、增量备份和差异备份(3)

 

 

首页Linux教程

背景:

阅读新闻

dump和restore命令实现全备、增量备份和差异备份

[日期:2013-08-18]   来源:Linux社区  作者:justdb   [字体:]  

五 dump和restore——实现差异备份

#演示差异备份
[root@serv01 data]# cd /backup/
[root@serv01 backup]# rm -rf *
[root@serv01 backup]# rm -rf data01.dump
[root@serv01 backup]# > /etc/dumpdates
#首先全备
[root@serv01 backup]# dump -0uf data01.dump/data/
 DUMP: Date of this level 0 dump: Fri Aug 2 11:43:51 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 16672 blocks.
 DUMP: Volume 1 started with block 1 at: Fri Aug  2 11:43:51 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:43:51 2013
 DUMP: Volume 1 16680 blocks (16.29MB)
 DUMP: 16680 blocks (16.29MB) on 1 volume(s)
 DUMP: finished in less than a second
 DUMP: Date of this level 0 dump: Fri Aug 2 11:43:51 2013
 DUMP: Date this dump completed: Fri Aug  2 11:43:51 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:43:51 2013 +0800
#拷贝fstab文件
[root@serv01 backup]# cp /etc/fstab /data/
#差异备份
[root@serv01 backup]# dump -1uf data02.dump/data/
 DUMP: Date of this level 1 dump: Fri Aug 2 11:44:20 2013
 DUMP: Date of last level 0 dump: Fri Aug 2 11:43:51 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:44:20 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:44:20 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:44:20 2013
 DUMP: Date this dump completed: Fri Aug  2 11:44:20 2013
 DUMP: Average transfer rate: 0 kB/s
 DUMP: DUMP IS DONE
#拷贝yum.conf文件
[root@serv01 backup]# cp /etc/yum.conf/data
[root@serv01 backup]# dump -1ufdata021.dump /data/
 DUMP: Date of this level 1 dump: Fri Aug 2 11:44:47 2013
 DUMP: Date of last level 0 dump: Fri Aug 2 11:43:51 2013
 DUMP: Dumping /dev/sdb1 (/data) to data021.dump
 DUMP: Label: none
 DUMP: Writing 10 Kilobyte records
 DUMP: mapping (Pass I) [regular files]
 DUMP: mapping (Pass II) [directories]
 DUMP: estimated 60 blocks.
 DUMP: Volume 1 started with block 1 at: Fri Aug  2 11:44:47 2013
 DUMP: dumping (Pass III) [directories]
 DUMP: dumping (Pass IV) [regular files]
 DUMP: Closing data021.dump
 DUMP: Volume 1 completed at: Fri Aug 2 11:44:47 2013
 DUMP: Volume 1 60 blocks (0.06MB)
 DUMP: 60 blocks (0.06MB) on 1 volume(s)
 DUMP: finished in less than a second
 DUMP: Date of this level 1 dump: Fri Aug 2 11:44:47 2013
 DUMP: Date this dump completed: Fri Aug  2 11:44:47 2013
 DUMP: Average transfer rate: 0 kB/s
 DUMP: DUMP IS DONE
#拷贝文件,然后差异备份
[root@serv01 backup]# cp /etc/networks/data
[root@serv01 backup]# dump -1ufdata0211.dump /data/
 DUMP: Date of this level 1 dump: Fri Aug 2 11:45:34 2013
 DUMP: Date of last level 0 dump: Fri Aug 2 11:43:51 2013
 DUMP: Dumping /dev/sdb1 (/data) to data0211.dump
 DUMP: Label: none
 DUMP: Writing 10 Kilobyte records
 DUMP: mapping (Pass I) [regular files]
 DUMP: mapping (Pass II) [directories]
 DUMP: estimated 65 blocks.
 DUMP: Volume 1 started with block 1 at: Fri Aug  2 11:45:34 2013
 DUMP: dumping (Pass III) [directories]
 DUMP: dumping (Pass IV) [regular files]
 DUMP: Closing data0211.dump
 DUMP: Volume 1 completed at: Fri Aug 2 11:45:34 2013
 DUMP: Volume 1 70 blocks (0.07MB)
 DUMP: 70 blocks (0.07MB) on 1 volume(s)
 DUMP: finished in less than a second
 DUMP: Date of this level 1 dump: Fri Aug 2 11:45:34 2013
 DUMP: Date this dump completed: Fri Aug  2 11:45:34 2013
 DUMP: Average transfer rate: 0 kB/s
 DUMP: DUMP IS DONE
 
#模拟数据删除
[root@serv01 backup]# cd /data
[root@serv01 data]# rm -rf *
#恢复时需要有全备的文件和想恢复的文件(或者最后一次),只需要两个
[root@serv01 data]# restore -rf/backup/data01.dump
[root@serv01 data]# restore -rf/backup/data021.dump
[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
fstab                                    passwd          vmlinuz-2.6.32-131.0.15.el6.x86_64
initramfs-2.6.32-131.0.15.el6.x86_64.img  restoresymtable  yum.conf
[root@serv01 data]# rm -rf *
[root@serv01 data]# restore -rf/backup/data01.dump
[root@serv01 data]# restore -rf/backup/data0211.dump
[root@serv01 data]# ls
config-2.6.32-131.0.15.el6.x86_64        inittab  restoresymtable                        yum.conf
fstab                                    networks 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
 
#差异备份:一定是在全备的基础上
 
#dd没有增量备份的功能
#磁盘拷贝(对拷)
[root@serv01 backup]# cd /data/
[root@serv01 data]# ls
[root@serv01 data]# cp /boot/* .
cp: omitting directory `/boot/efi'
cp: omitting directory `/boot/grub'
cp: omitting directory `/boot/lost+found'
[root@serv01 data]# dd if=/dev/sdb1of=/dev/sdc1
dd: writing to `/dev/sdc1': Input/outputerror
4192897+0 records in
4192896+0 records out
2146762752 bytes (2.1 GB) copied, 71.3082s, 30.1 MB/s
[root@serv01 data]# df -h
Filesystem            Size Used Avail Use% Mounted on
/dev/sda2            9.7G  1.1G 8.1G  12% /
tmpfs                188M    0 188M  0% /dev/shm
/dev/sda1            194M  25M 160M  14% /boot
/dev/sda5            4.0G  137M 3.7G  4% /opt
/dev/sr0              3.4G 3.4G    0 100% /iso
/dev/sdb1            2.0G  54M 1.9G  3% /data
/dev/sdc1            2.0G  35M 1.9G  2% /backup
[root@serv01 data]# ls /backup/
config-2.6.32-131.0.15.el6.x86_64        symvers-2.6.32-131.0.15.el6.x86_64.gz vmlinuz-2.6.32-131.0.15.el6.x86_64
initramfs-2.6.32-131.0.15.el6.x86_64.img  System.map-2.6.32-131.0.15.el6.x86_64

 

磁盘管理——RAID 5

tar命令使用及tar实现全备份和增量备份

相关资讯      

   

本文评论   查看全部评论 (0)


评论声明

尊重网上道德,遵守中华人民共和国的各项有关法律法规

承担一切因您的行为而直接或间接导致的民事或刑事法律责任

本站管理人员有权保留或删除其管辖留言中的任意内容

本站有权在网站内转载或引用您的评论

参与本评论即表明您已经阅读并接受上述条款

 

 

 

最新资讯

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/19362.html