Linux 命令dump的压缩参数z用得好,能使打包文件小很多. 经试验, 我认为最佳的压缩参数应为: -z4 或 –z5
压缩级别 用时 原文件大小 压缩后的文件大小
-z2 5:13 1941.56MB 970MB
-z4 7:55 1941.56MB 357MB
-z5 7:56 1941.56MB 353MB
-z8 9:57 1941.56MB 351MB
测试如下:
#进入单用户方式:
#init s
[root@rh9 home]# df -k
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/hda1 3091284 1951416 982836 67% /
/dev/hda3 774040 18564 716120 3% /home
none 62996 0 62996 0% /dev/shm
/dev/sda1 3953036 671956 3080272 18% /mnt/a
/dev/sda2 4743808 665068 3837768 15% /mnt/b
/dev/sda3 5747940 32828 5423132 1% /mnt/c
#
[root@rh9 home]# dump -0uf /mnt/c/sysbak.dump / (缺省:-z2)
DUMP: Date of this level 0 dump: Wed Dec 13 15:26:43 2006
DUMP: Dumping /dev/hda1 (/) to /mnt/c/sysbak.dump
DUMP: Added inode 8 to exclude list (journal inode)
DUMP: Added inode 7 to exclude list (resize inode)
DUMP: Label: /
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 1869529 tape blocks.
DUMP: Volume 1 started with block 1 at: Wed Dec 13 15:26:46 2006
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: 100.00% done at 6310 kB/s, finished in 0:00
DUMP: Closing /mnt/c/sysbak.dump
DUMP: Volume 1 completed at: Wed Dec 13 15:31:59 2006
DUMP: Volume 1 1988160 tape blocks (1941.56MB)
DUMP: Volume 1 took 0:05:13
DUMP: Volume 1 transfer rate: 6351 kB/s
DUMP: 1988160 tape blocks (1941.56MB) on 1 volume(s)
DUMP: finished in 313 seconds, throughput 6351 kBytes/sec
DUMP: Date of this level 0 dump: Wed Dec 13 15:26:43 2006
DUMP: Date this dump completed: Wed Dec 13 15:31:59 2006
DUMP: Average transfer rate: 6351 kB/s
DUMP: DUMP IS DONE
[root@rh9 c]# dump -z4 -0uf /mnt/c/sysbak-z4.dump /dev/hda1
DUMP: Date of this level 0 dump: Wed Dec 13 15:46:25 2006
DUMP: Dumping /dev/hda1 (/) to /mnt/c/sysbak-z4.dump
DUMP: Added inode 8 to exclude list (journal inode)
DUMP: Added inode 7 to exclude list (resize inode)
DUMP: Label: /
DUMP: Compressing output at compression level 4 (zlib)
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 1869546 tape blocks.
DUMP: Volume 1 started with block 1 at: Wed Dec 13 15:46:28 2006
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: 68.45% done at 4265 kB/s, finished in 0:02
DUMP: Closing /mnt/c/sys-z4.dump
DUMP: Volume 1 completed at: Wed Dec 13 15:54:23 2006
DUMP: Volume 1 took 0:07:55
DUMP: Volume 1 transfer rate: 1541 kB/s
DUMP: Volume 1 1988180kB uncompressed, 732275kB compressed, 2.716:1
DUMP: 1988180 tape blocks (1941.58MB) on 1 volume(s)
DUMP: finished in 475 seconds, throughput 4185 kBytes/sec
DUMP: Date of this level 0 dump: Wed Dec 13 15:46:25 2006
DUMP: Date this dump completed: Wed Dec 13 15:54:23 2006
DUMP: Average transfer rate: 1541 kB/s
DUMP: Wrote 1988180kB uncompressed, 732275kB compressed, 2.716:1
DUMP: DUMP IS DONE
[root@rh9 /]# dump -z5 -0uf /mnt/c/sysbak-z5.dump /dev/hda1
DUMP: Date of this level 0 dump: Wed Dec 13 15:34:28 2006
DUMP: Dumping /dev/hda1 (/) to /mnt/c/sysbak-z5.dump
DUMP: Added inode 8 to exclude list (journal inode)
DUMP: Added inode 7 to exclude list (resize inode)
DUMP: Label: /
DUMP: Compressing output at compression level 5 (zlib)
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 1869536 tape blocks.
DUMP: Volume 1 started with block 1 at: Wed Dec 13 15:34:30 2006
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: 66.81% done at 4149 kB/s, finished in 0:02
DUMP: Closing /mnt/c/sys.dump
DUMP: Volume 1 completed at: Wed Dec 13 15:42:26 2006
DUMP: Volume 1 took 0:07:56
DUMP: Volume 1 transfer rate: 1520 kB/s
DUMP: Volume 1 1988170kB uncompressed, 723886kB compressed, 2.747:1
DUMP: 1988170 tape blocks (1941.57MB) on 1 volume(s)
DUMP: finished in 475 seconds, throughput 4185 kBytes/sec
DUMP: Date of this level 0 dump: Wed Dec 13 15:34:28 2006
DUMP: Date this dump completed: Wed Dec 13 15:42:26 2006
DUMP: Average transfer rate: 1520 kB/s
DUMP: Wrote 1988170kB uncompressed, 723886kB compressed, 2.747:1
DUMP: DUMP IS DONE
[root@rh9 c]# dump -z8 -0uf /mnt/c/sysbak-z8.dump /dev/hda1
DUMP: Date of this level 0 dump: Wed Dec 13 15:55:39 2006
DUMP: Dumping /dev/hda1 (/) to /mnt/c/sysbak-z8.dump
DUMP: Added inode 8 to exclude list (journal inode)
DUMP: Added inode 7 to exclude list (resize inode)
DUMP: Label: /
DUMP: Compressing output at compression level 8 (zlib)
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 1869556 tape blocks.
DUMP: Volume 1 started with block 1 at: Wed Dec 13 15:55:42 2006
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: 51.04% done at 3180 kB/s, finished in 0:04
DUMP: Closing /mnt/c/sys-z8.dump
DUMP: Volume 1 completed at: Wed Dec 13 16:05:39 2006
DUMP: Volume 1 took 0:09:57
DUMP: Volume 1 transfer rate: 1205 kB/s
DUMP: Volume 1 1988190kB uncompressed, 719903kB compressed, 2.762:1
DUMP: 1988190 tape blocks (1941.59MB) on 1 volume(s)
DUMP: finished in 597 seconds, throughput 3330 kBytes/sec
DUMP: Date of this level 0 dump: Wed Dec 13 15:55:39 2006
DUMP: Date this dump completed: Wed Dec 13 16:05:39 2006
DUMP: Average transfer rate: 1205 kB/s
DUMP: Wrote 1988190kB uncompressed, 719903kB compressed, 2.762:1
DUMP: DUMP IS DONE
[root@rh9 c]# ls -l
总用量 4170476
-rw-r--r-- 1 root root 2191360 12月 13 15:33 home.dump
drwx------ 2 root root 16384 2006-12-13 lost+found
-rw-r--r-- 1 root root 2035875840 12月 13 15:31 sysbak.dump
-rw-r--r-- 1 root root 749850016 12月 13 15:54 sysbak-z4.dump
-rw-r--r-- 1 root root 741259949 12月 13 15:42 sysbak-z5.dump
-rw-r--r-- 1 root root 737181246 12月 13 16:05 sysbak-z8.dump
带压缩选项用:-z4 或 -z5