(Linux learning Note one: compression) [20180209]

Source: Internet
Author: User
Tags bz2

Study Note one: Compress February 5, 2015 10:23 compress commandThe zip file extension is mostly *.tar,*. tar.gz,*.tgz,*.gz,*. Z,*.bz2 Common compression commands gzip with bzip2, where bzip2 compression is better than gziptar can be used for file packaging and can support gzip and bzip2 compression compression tar-jvc-f filename.tar.bz2/directoryQuery Tar-jtv-f filename.tar.bz2Unzip tar-jxv-f filename.tar.bz2-c/puorose/directory The Dump command can back up a file system or a single directory the backup of Dump can be 0~9 level Differential backup for file system. Where level 0 is a full backup The Restore command restores the backup file that was built by dump to create a new disc to burn data, you can use the mkisofs command to build can be written to CD or DVD burner via Cdrecord DD can back up the full partition or disk because DD can read the hard disk's sector surface data Cpio is a pretty good backup command, but it has to be read into the preliminary file with a similar find command. Test walkthroughsgzip and bzip2 compression tar packaging use gzip compression format and exclude log and BZ compression files [Email protected] schema]$ tar-zcv-f schema_tar_test.tar.gz--exclude=/u03/schema/*.log--exclude=/u03/schema/*.bz/ U03/schemause bzip2 compression format and exclude log and gz compression files [Email protected] schema]$ tar-jcv-f schema_tar_test.tar.bz2--exclude=/u03/schema/*.log--exclude=/u03/schema/*.gz /u03/schema view both compression ratios [[email protected] schema]$ du-sh schema_tar_test.tar.*160k Schema_tar_test.tar.bz2260K Schema_ Tar_test.tar.gzDump backup file system Simulates a file drive letter [[email protected] u04]# dd if=/dev/zero of=/u04/loop_mount bs=1m count=10241024+0 Records in1024+0 Records out1073741824 bytes (1.1 GB) copied, 8.35942 seconds, $ mb/s[[email protected] u04]#  mkfs.ext3/u04/l Oop_mount[[email protected] u04]# mount-o loop /u04/loop_mount/u04/mount_loop[[email protected] u04 ]# df-hfilesystem            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%/boottmpfs                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 create dump backup directory [[email protected] u04]# mkdir backup[[email protected] 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  DU mp:writing 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 1st arted with block 1 at:thu feb  5 10:08:25 2015  dump:dumping (Pass III) [directories]  dump:dumping (Pas s 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 uncomp ressed, 5627kB compressed, 189.626:1  dump:1067020 blocks (1042.01MB) on 1 volume (s)   dump:finished in Seco NDS, Throughput 29639 kbytes/sec  Dump:date of this, 0 Dump:thu feb  5 10:08:25 2015  dump:date this DUMP completed:  Thu F eb  5 10:09:01 2015  dump:average transfer rate:156 kb/s  dump:wrote 1067020kB uncompressed, 5627kB comp ressed, 189.626:1  Dump:dump is done[[email protected] u04]# ls-l/u04/backup/total 5640-rw-r--r--1 root root 5762814 feb  5 10:09 dump.bak[[email protected] u04]# du-sh/u04/backup/5.6m   /u04/backup/ Test add file to directory [[email protected] u04]# CP ogg.tar.gz/u04/mount_loop/[[email protected] u04]# Du-sh/u04/mount_ loop/503m   /u04/mount_loop/[[email protected] u04]# dump-1-j-f/u04/backup/dump.bak/u04/loop _mountdump:only Level 0 dumps is allowed on a subdirectory ( not a single file system ) Dump:the entire dump is aborted.backup boot drive letter test [email protected] u04]# dump-0-j-f/u04/backup/dump_boot.bak /dev/sda1 [Email protected] u04]# dump-1-j-f/u04/backup/dump_boo01.bak/dev/sda1 DUMP:WARNING:There are no inferior level dump On this filesystemDUMP:WARNING:Assuming A Level 0 DUMP by default (boot directory also no differential backup?) )[Email protected] u04]# cd/u04/backup/[[email protected] backup]# lsdump.bak dump_boo01.bak dump_boot.bak[[email prote CTED] backup]# du-sh *5.6m dump.bak16m dump_boo01.bak16m Dump_boot.bak
Database Ip Gzip Bzip2
Xxxxx xxx.xxx.xxx.xxx 2015/3/22 10:22:00 ~2015/3/23 01:5,600 3 hours 16GB 2015/03/25 09:05~2015/03/26 00:56 16 hours 9.2GB

(Linux learning Note one: compression) [20180209]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.