Professional Documents
Culture Documents
Learning Objectives:
1.
2.
To introduce different archive utilities for file compression with their usage To compare & summarized different archive utilities
Archive Utilities
Table of Content
Compress gzip compression Zip compression (PC Compatible) Zip (PC pkzip Compatible) Unzip (PC pkunzip Compatible) tar archive
Recovery from disasters (disk crash) Human errors (accidentally deleting files / directory) Software errors that corrupts data / files (including virus)
Good idea to keep multiple generations and strategic snapshots (e.g. year end / month end) of backups Backup devices tapes, magnetic-optical (MO) disks, CDR/CDRW, (disk files usually not very good)
Summary
Archive Restore List Usage Notes
compress
(*) gzip
uncompress
gzip -d gzip -l
unzip
tar xvf
unzip -v
tar cvf
Backup Multiple files/ dir. (with owners / group) For your reference only
(*) Not available in all systems, may need to download, see www.gnu.org
Compress / Uncompress
Compression single file and available on most systems Compressed .z file smaller, file date preserved Actually compression ratio depend on data (text file and database files usually larger)
$ ls -l buyer* 22651778 Nov 16 18:45 buyer.dbf $ compress buyer.dbf $ ls -l buyer* 3603257 Nov 16 18:45 buyer.dbf.Z $ uncompress buyer.dbf.Z $ ls -l buyer* 22651778 Nov 16 18:45 buyer.dbf
14%) 19%)
$ tar tvf /tmp/tar1.tar tar: blocksize = 10 drwxr-xr-x -rw-r--r-drwxr-xr-x -rw-r--r--rw-r--r-4110/1501 4110/1501 4110/1501 4110/1501 4110/1501 0 9 0 14 16
Replace output file with tape drive device file, e.g. /dev/st[0-7] (in Linux) /dev/rmt/[0-7]* (in Sun) /dev/rStp[0-7] (in SCO UNIX)
1 1 1 1 1
$ tar xvf /tmp/tar1.tar.Z Cannot extract directly, need uncompress tar: tape blocksize error $ cd /tmp; uncompress < /tmp/tar1.tar.Z | tar xvf tar: blocksize = 10 gtar xvfz /tmp/tar1.tar.Z x ., 0 bytes, 0 tape blocks x ./letter0, 9 bytes, 1 tape blocks x ./secret, 0 bytes, 0 tape blocks x ./secret/letter1, 14 bytes, 1 tape blocks x ./secret/letter2, 16 bytes, 1 tape blocks tar: can't set time on .: Not owner
$ tar xvf /tmp/tar2.tar.z gzip c: use standard input/output tar: tape blocksize error $ cd /tmp; gzip -c -d < /tmp/tar2.tar.z | tar xvf tar: blocksize = 10 x ., 0 bytes, 0 tape blocks gtar xvfz /tmp/tar2.tar.z x ./letter0, 9 bytes, 1 tape blocks x ./secret, 0 bytes, 0 tape blocks x ./secret/letter1, 14 bytes, 1 tape blocks x ./secret/letter2, 16 bytes, 1 tape blocks tar: can't set time on .: Not owner
Summary
Archive Restore List Usage Notes
compress
(*) gzip
uncompress
gzip -d gzip -l
unzip
tar xvf
unzip -v
tar cvf
Backup Multiple files/ dir. (with owners / group) For your reference only
(*) Not available in all systems, may need to download, see www.gnu.org