[root@localhost ~]# yum -y install dump
[root@localhost ~]# dump [选项] 备份之后的文件名 原文件或目录
选项:
[root@localhost ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda3 20G 3.0G 16G 17% /
tmpfs 30 6M 0 30 6M 0% /dev/shm
/dev/sda1 194M 26M 158M 15% /boot
/dev/sr0 3.5G 3.5G 0 100% /mnt/cdrom
#系统中我们就分了/分区和/boot分区。根分区太大,备份速度太慢,我们还是备份/boot分区吧
[rootSlocalhost ~]# dump -0uj -f /root/boot.bak.bz2 /boot/
#备份命令。先执行一次完全备份,并压缩和更新备份时间
DUMP: Date of this level 0 dump: Wed Jun 5 03:08:22 2013
#备份的级别和时间
DUMP: Dumping /dev/sdal (/boot) to /root/boot.bak.bz2
#备份源和目标
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 21846 blocks.
DUMP: Volume 1 started with block 1 at: Wed Jun 5 03:08:22 2013
DUMP: dumping (Pass III) [directories]
#开始dump 备份
DUMP: dumping (Pass XV) [regular files]
DUMP: Closing /root/boot.bak.bz2
#备份结朿,生成备份文件
DUMP: Volume 1 completed at: Wed Jun 5 03:08:30 2013
DUMP: Volume 1 took 0:00:08
DUMP: Volume 1 transfer rate: 2370 kB/s
DUMP: Volume 1 21930kB uncompressed, 18962kB compressed, 1.157:1
#数据容量
DUMP: 2X930 blocks (21.42MB) on 1 volume(s)
DUMP: finished in 7 seconds, throughput 3132 kBytes/sec
DUMP: Date of this level 0 dump: Wed Jun 5 03:08:22 2013
DUMP: Date this dump completed: Wed Jun 5 03:08:30 2013
DUMP: Average transfer rate: 2370 kB/s
DUMP: Wrote 21930kB uncompressed, 18962kB compressed, 1.157:1
[root@localhost ~]# cat /etc/dumpdates
#查看备份时间文件
/dev/sdal 0 Wed Jun 5 03:08:22 2013 +0800
#备份的分区 备份级别 备份曰期
[root@localhost @]# 11 -h /root/boot.bak.bz2
-rw-r--r--. 1 root root 19M 6 月 5 03:08 /root/boot.bak.bz2
#备份文件生成了
[root@localhost ~]# ll -h /root/install.log
-rw-r--r--.1 root root 25K 4月 10 21:49 /root/install.log
#查看安装软件包日志的大小为25KB
[root@localhost ~]# cp install.log /boot/
#复制日志文件到/boot分区
[root@localhost ~]# dump -1uj -f /root/boot.bak1.bz2 /boot/
#增量备份/boot分区,并压缩
[root@localhost ~]# ll -h boot.bak*
-rw-r--r--.1 root root 18K 6月 5 03:16 boot.bak1.bz2
-rw-r--r--.1 root root 19M 6月 5 03:08 boot.bak.bz2
#boot.bak1.bz2压缩文件只有18KB,证明增量备份只备份了0级别以后变化的数据
#boot.bak1.bz2压缩文件只有18KB,证明增量备份只备份了0级别以后变化的数据
[root@localhost ~]# dump -W
Last dump(s) done (Dump '>' file systems):
/dev/sda3 ( /) Last dump:Level 1, Date Wed Jun 5 02:31:50 2013
/dev/sda1 ( /boot) Last dump:Level 1, Date Wed Jun 5 03:16:27 2013
#我的/分区和/boot分区都进行过dump备份,/boot分区的最新备份级别是1
[root@localhost ~]# dump -0j -f /root/etc.dump.bz2 /etc/
#完全备份/etc/目录
[root@localhost ~]# ll -h /root/etc.dump.bz2
-rw-r--r--.1 root root 8.6M 6月 5 03:26 /root/etc.dump.bz2
#查看备份文件
不过,如果使用增量备份会怎么样呢?命令如下:
[root@localhost ~]# dump -1j -f /root/etc.dump1.bz2 /etc/
DUMP:Only level 0 dumps are allowed on a subdirectory
DUMP:The ENTIRE dump is aborted.
#备份失败了,目录备份只能使用0级别
本文链接:http://task.lmcjl.com/news/11984.html