学习笔记一:压缩
2015年2月5日
上午 10:23
压缩命令
压缩文件的扩展名大多是*.tar、*.tar.gz、*.tgz、*.gz、*.Z、*.bz2
常见的压缩命令gzip与bzip2,其中bzip2压缩比gzip要好
tar可以用来进行文件打包,并可支持gzip和bzip2的压缩
压缩 tar -jvc -f  filename.tar.bz2 /directory
查询 tar -jtv -f  filename.tar.bz2
解压 tar -jxv -f filename.tar.bz2 -C /puorose/directory
Dump 命令可备份文件系统或单一目录
Dump 的备份若针对文件系统时,可进行0~9的level差异备份。其中level为0为完整备份
restore命令可以还原被dump构建的备份文件
要新建光盘刻录数据时,可通过mkisofs命令来构建
可通过cdrecord来写入CD或DVD刻录机
dd可备份完整的分区或磁盘,因为dd可读取硬盘的扇区表面数据
cpio为相当优秀的备份命令,不过必须要搭配类似find命令来读入预备份文件
测试演练
gzip与bzip2压缩
 
tar打包
使用gzip压缩格式并且排除log和bz压缩档
[oracle@xitest01 schema]$  tar -zcv -f schema_tar_test.tar.gz --exclude=/u03/schema/*.log --exclude=/u03/schema/*.bz   /u03/schema
使用bzip2压缩格式并且排除log和gz压缩档
[oracle@xitest01 schema]$  tar -jcv -f schema_tar_test.tar.bz2 --exclude=/u03/schema/*.log --exclude=/u03/schema/*.gz   /u03/schema
查看两者压缩比例
[oracle@xitest01 schema]$ du -sh schema_tar_test.tar.*
160K    schema_tar_test.tar.bz2
260K    schema_tar_test.tar.gz
dump备份文件系统
模拟一个文件盘符
[root@xitest01 u04]# dd if=/dev/zero of=/u04/loop_mount bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 8.35942 seconds, 128 MB/s
[root@xitest01 u04]#  mkfs.ext3 /u04/loop_mount
[root@xitest01 u04]# mount -o loop  /u04/loop_mount /u04/mount_loop
[root@xitest01 u04]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             9.7G  5.4G  3.9G  59% /
/dev/sda6              31G  1.9G   28G   7% /u02
/dev/sda5              30G   21G  7.1G  75% /u01
/dev/sda1             190M   23M  158M  13% /boot
tmpfs                1005M     0 1005M   0% /dev/shm
/dev/sdb              504G  263G  216G  55% /u03
/dev/sdc1             504G  312G  167G  66% /u04
/u04/loop_mount      1008M   34M  924M   4% /u04/mount_loop
创建dump备份目录
[root@xitest01 u04]# mkdir backup
[root@xitest01 u04]#  dump -0 -j -f /u04/backup/dump.bak /u04/loop_mount
 DUMP: Dumping /dev/sdc1 (/u04 (dir /loop_mount)) to /u04/backup/dump.bak
  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 1067027 blocks.
  DUMP: Volume 1 started with block 1 at: Thu Feb  5 10:08:25 2015
  DUMP: dumping (Pass III) [directories]
  DUMP: dumping (Pass IV) [regular files]
  DUMP: Closing /u04/backup/dump.bak
  DUMP: Volume 1 completed at: Thu Feb  5 10:09:01 2015
  DUMP: Volume 1 took 0:00:36
  DUMP: Volume 1 transfer rate: 156 kB/s
  DUMP: Volume 1 1067020kB uncompressed, 5627kB compressed, 189.626:1
  DUMP: 1067020 blocks (1042.01MB) on 1 volume(s)
  DUMP: finished in 36 seconds, throughput 29639 kBytes/sec
  DUMP: Date of this level 0 dump: Thu Feb  5 10:08:25 2015
  DUMP: Date this dump completed:  Thu Feb  5 10:09:01 2015
  DUMP: Average transfer rate: 156 kB/s
  DUMP: Wrote 1067020kB uncompressed, 5627kB compressed, 189.626:1
  DUMP: DUMP IS DONE
[root@xitest01 u04]# ls -l /u04/backup/
total 5640
-rw-r--r-- 1 root root 5762814 Feb  5 10:09 dump.bak
[root@xitest01 u04]# du -sh /u04/backup/
5.6M    /u04/backup/
测试加入文件至目录
[root@xitest01 u04]# cp ogg.tar.gz /u04/mount_loop/
[root@xitest01 u04]# du -sh /u04/mount_loop/
503M    /u04/mount_loop/
[root@xitest01 u04]# dump -1 -j -f /u04/backup/dump.bak /u04/loop_mount
DUMP: Only level 0 dumps are allowed on a subdirectory (不是单一文件系统)
  DUMP: The ENTIRE dump is aborted.
备份boot盘符测试
[root@xitest01 u04]# dump -0 -j -f /u04/backup/dump_boot.bak  /dev/sda1
[root@xitest01 u04]# dump -1 -j -f /u04/backup/dump_boo01.bak /dev/sda1
 DUMP: WARNING: There is no inferior level dump on this filesystem
  DUMP: WARNING: Assuming a level 0 dump by default (boot目录也没差异备份吗?)
[root@xitest01 u04]# cd /u04/backup/
[root@xitest01 backup]# ls
dump.bak  dump_boo01.bak  dump_boot.bak
[root@xitest01 backup]# du -sh *
5.6M    dump.bak
16M     dump_boo01.bak
16M     dump_boot.bak
 
 

Database
Ip
Gzip
 
Bzip2
 
xxxxx
xxx.xxx.xxx.xxx
2015/3/22 10:22:00 ~2015/3/23 01:5600 3小時
16GB
2015/03/25 09:05~2015/03/26 00:56 16小時
9.2GB
 
 
 
 
 
 
 
 
 

(Linux学习笔记一:压缩)[20180209]的更多相关文章

  1. linux 学习笔记 显示压缩文件 gong.zip 的文件内容

    #zip -v gong zip zip info: xxx >删除压缩文件中俄smart.txt 文件 #zip -d gong.zip smart.txt deleting:smart.tx ...

  2. Linux 学习笔记 5 文件的下载、压缩、解压、初步认识yum

    写在前面 上节我们通过简单的几组命令,已经完全的实现了文件的移动.删除.更名.以及复制,我们最常用的基本玩法,本节将带着大家学习压缩.解压的相关步骤. Linux 学习笔记 4 创建.复制.移动.文件 ...

  3. Linux 学习笔记

    Linux学习笔记 请切换web视图查看,表格比较大,方法:视图>>web板式视图 博客园不能粘贴图片吗 http://wenku.baidu.com/view/bda1c3067fd53 ...

  4. Linux学习笔记-林耐斯Notes-Linux就该这么学

    Linux学习笔记... 参考的优秀Linux网站: http://www.w3cschool.cn/linux/ http://www.linuxeye.com/ http://linux.vbir ...

  5. deepin linux学习笔记

    目录 deepin linux学习笔记 前言 linux常用命令 ls 显示文件夹内容 cd 切换当前目录 pwd 查看当前工作目录 mkdir 新建文件夹 rm 删除文件或文件夹 mv 移动文件 c ...

  6. Linux 学习笔记之超详细基础linux命令 Part 13

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 12---------------- ...

  7. Linux 学习笔记之超详细基础linux命令 Part 11

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 10---------------- ...

  8. Linux 学习笔记之超详细基础linux命令 Part 10

    Linux学习笔记之超详细基础linux命令 by:授客 QQ:1033553122 ---------------------------------接Part 9----------------- ...

  9. 91 Testing Linux学习笔记

    91 Testing Linux学习笔记... 学习地址:91Testing 的Linux教程=====================学习网址:http://www.91testing.net/ar ...

随机推荐

  1. KMP算法的一个简单实现

    今天学习KMP算法,参考网上内容,实现算法,摘录网页内容并记录自己的实现如下: 原文出处: http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93M ...

  2. Caffe&Torch&Theano&TensorFlow

    https://www.youtube.com/watch?v=Qynt-TxAPOs&index=12&list=PL16j5WbGpaM0_Tj8CRmurZ8Kk1gEBc7fg ...

  3. 完整SQL分页存储过程(支持多表联接)

    http://www.cnblogs.com/andiki/archive/2009/03/24/1420289.html Code/********************************* ...

  4. Python爬虫教程-29-验证码识别-Tesseract-OCR

    本篇是关于验证码识别问题,也是Python爬虫笔记的一个结尾,使用 Tesseract Python爬虫教程-29-验证码识别-Tesseract-OCR 常见反爬虫手段: 验证码 1.简单图片,扭曲 ...

  5. 十八、移动端rem布局

    使用rem布局,首先要知道自己是根据UI给的视效图的多少基准的,这里是以750px为基准,代码如下: //rem布局,此处根据750px来设置,放大100倍 (function(doc, win) { ...

  6. IIS Post 大小超出允许的限制

    IIS限制默认POST的长度是4096 Byte 在IIS——配置编辑器——system.web/httpRuntime的maxRequestLength 或者在web.config文件中的syste ...

  7. Apache2.4和IIS7整合共享80端口测试

    言我再重新排版一下 在C:\Windows\System32\drivers\etc\hosts文件中配置2个测试域名用于整合测试 127.0.0.1 www.aaa.com // apache项目 ...

  8. Useful WCF Behaviors - IErrorHandler

    Behaviors in WCF are so stinking useful, and once you get past the basics of WCF they're arguably a ...

  9. UIScrollView中的手势

    UIScrollView中的手势 UIScrollView自带了两个手势,分别为: UIPanGestureRecognizer UIPinchGestureRecognizer 他们都是readon ...

  10. QT的定时器使用

    http://blog.csdn.net/steven6977/article/details/9310997