[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級別
新聞熱點
疑難解答