Linux dump命令

dump - ext2/3 filesystem backup 在使用dump进行备份的时候,可以使用不同的备份等级(level), 当使用level 0进行备份的时候,就是最初的完整备份,然后可以再使用level 1对在进行了level 0备份后的基础上,对有改动的地方进行备份,依次类推level 2......。dump不仅可以针对整个文件系统进行备份,也可以针对单一目录进行备份,但是在对单一目录进行备份的时候,就不支持使用备份等级,就只能使用最初的完整备份(level 0)

命令格式dump [-Suvj] [-level] [-f 备份档] 待备份资料 更多详细信息,可以参考man dump页面,友情链接:Linux restore命令

参数说明

  • -S:仅列出后面的待备份数据需要多少磁盘空间才能够备份完毕
  • -u:将这次dump的时间记录到/etc/dumpdates文件中
  • -v:显示dump的备份过程
  • -j:加入bzip2的支持!将数据进行压缩,默认bzip2压缩等级为2,如果不用-j参数,dump默认是不会使用压缩功能
  • -level:备份等级,从-0~-9共十个等级,对单一目录进行备份,就只能用-0参数进行备份
  • -f:有点类似tar命令,后面接产生的档案,也可以接例如/dev/st0装置文件名
  • -W:列出在/etc/fstab里面的具有dump设定的partition是否有备份过

针对整个文件系统进行备份

[root@rhel6164 ~]# dump -u0j -f /tmp/boot.bakup /boot
  DUMP: Date of this level 0 dump: Thu Dec 25 09:21:28 2014
  DUMP: Dumping /dev/vda1 (/boot) to /tmp/boot.bakup
  DUMP: Label: none
  DUMP: Writing 10 Kilobyte records
  DUMP: Compressing output at compression level 2 (bzlib)
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 21510 blocks.
  DUMP: Volume 1 started with block 1 at: Thu Dec 25 09:21:28 2014
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: Closing /tmp/boot.bakup
  DUMP: Volume 1 completed at: Thu Dec 25 09:21:35 2014
  DUMP: Volume 1 took 0:00:07
  DUMP: Volume 1 transfer rate: 2761 kB/s
  DUMP: Volume 1 21590kB uncompressed, 19328kB compressed, 1.118:1
  DUMP: 21590 blocks (21.08MB) on 1 volume(s)
  DUMP: finished in 7 seconds, throughput 3084 kBytes/sec
  DUMP: Date of this level 0 dump: Thu Dec 25 09:21:28 2014
  DUMP: Date this dump completed:  Thu Dec 25 09:21:35 2014
  DUMP: Average transfer rate: 2761 kB/s
  DUMP: Wrote 21590kB uncompressed, 19328kB compressed, 1.118:1
  DUMP: DUMP IS DONE
[root@rhel6164 ~]# cat /etc/dumpdates #备份信息
/dev/vda1 0 Thu Dec 25 09:21:28 2014 +0800
[root@rhel6164 ~]# touch /boot/testing #修改/boot内容
[root@rhel6164 ~]# dump -u1j -f /tmp/boot.bakup1 /boot #重新备份
  DUMP: Date of this level 1 dump: Thu Dec 25 09:24:08 2014
  DUMP: Date of last level 0 dump: Thu Dec 25 09:21:28 2014
  DUMP: Dumping /dev/vda1 (/boot) to /tmp/boot.bakup1
  DUMP: Label: none
  DUMP: Writing 10 Kilobyte records
  DUMP: Compressing output at compression level 2 (bzlib)
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 47 blocks.
  DUMP: Volume 1 started with block 1 at: Thu Dec 25 09:24:08 2014
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: Closing /tmp/boot.bakup1
  DUMP: Volume 1 completed at: Thu Dec 25 09:24:08 2014
  DUMP: 50 blocks (0.05MB) on 1 volume(s)
  DUMP: finished in less than a second
  DUMP: Date of this level 1 dump: Thu Dec 25 09:24:08 2014
  DUMP: Date this dump completed:  Thu Dec 25 09:24:08 2014
  DUMP: Average transfer rate: 0 kB/s
  DUMP: Wrote 50kB uncompressed, 11kB compressed, 4.546:1
  DUMP: DUMP IS DONE
[root@rhel6164 ~]# cat /etc/dumpdates #备份信息
/dev/vda1 0 Thu Dec 25 09:21:28 2014 +0800
/dev/vda1 1 Thu Dec 25 09:24:08 2014 +0800
[root@rhel6164 ~]# ll /tmp/* | grep boot #备份文件
-rw-r--r-- 1 root    root    19792161 Dec 25 09:21 boot.bakup
-rw-r--r-- 1 root    root       11299 Dec 25 09:24 boot.bakup1


针对单一目录进行备份

[root@rhel6164 ~]# dump -0j -f /tmp/etc.bakup /etc #这里只能用-0参数进行最初的完整备份
  DUMP: Date of this level 0 dump: Thu Dec 25 09:33:36 2014
  DUMP: Dumping /dev/mapper/vg_rhel6164-lv_root (/ (dir etc)) to /tmp/etc.bakup
  DUMP: Label: none
  DUMP: Writing 10 Kilobyte records
  DUMP: Compressing output at compression level 2 (bzlib)
  DUMP: mapping (Pass I) [regular files]
  DUMP: mapping (Pass II) [directories]
  DUMP: estimated 38493 blocks.
  DUMP: Volume 1 started with block 1 at: Thu Dec 25 09:33:37 2014
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: Closing /tmp/etc.bakup
  DUMP: Volume 1 completed at: Thu Dec 25 09:33:46 2014
  DUMP: Volume 1 took 0:00:09
  DUMP: Volume 1 transfer rate: 1196 kB/s
  DUMP: Volume 1 43970kB uncompressed, 10765kB compressed, 4.085:1
  DUMP: 43970 blocks (42.94MB) on 1 volume(s)
  DUMP: finished in 9 seconds, throughput 4885 kBytes/sec
  DUMP: Date of this level 0 dump: Thu Dec 25 09:33:36 2014
  DUMP: Date this dump completed:  Thu Dec 25 09:33:46 2014
  DUMP: Average transfer rate: 1196 kB/s
  DUMP: Wrote 43970kB uncompressed, 10765kB compressed, 4.085:1
  DUMP: DUMP IS DONE

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值