Flylib.com

Books Software

 
 
 

Chapter 23. Archiving and Compression

Chapter 23. Archiving and Compression

Introduction

Backup Levels

Related Files

Commands

 

Introduction

The commands in this section deal with the compression, storage, and extraction of system files. Typically, you'll want to compress and store at the same time—no need to take up 200M of storage space when 100M will do.

graphics/tip.gif

One of the biggest differences between a professional systems administrator and some incompetent who knows a few commands is that the systems administrator has a good backup strategy.

 

A full backup saves every file within some specified set. An incremental backup backs up only those files that have been changed since the previous backup. The idea behind making incremental backups is that the bulk of the files on the system never change, so it's unnecessarily expensive in terms of time and disk space to keep copying them over and over. The downside is that when you're mixing full and incremental backups, it's more complicated to restore the system to its original state after a disaster.

Of the compression utilities listed here, the two most popular are probably compress and gzip. Compress (.Z file extension) used to go out with all UNIX distributions, so you see it around a lot. Gzip (.gz file extension) is more efficient and happens to have fewer license restrictions, so it's probably the best choice for day-to-day work.

 

Backup Levels

The UNIX world has adopted the concept of numeric backup levels to describe which files are being saved in a given backup.

Level

Meaning

Full backup of all files.

1

Backup of all files modified since the last time a level 0 backup was performed.

2

Backup of all files modified since the most recent level 1 backup.

 

graphics/tip.gif

At some point in your life, your computer will crash, and you will lose all the data on it. Whether this is a temporary inconvenience or the first step down the road to suicide is entirely dependent on your level of preparation. Right now, right this second, you should think about what you have on your machine that you can't afford to lose. Is it being backed up? If not, go do something about it.

 

graphics/tip.gif

Once you've settled on a backup strategy, you can automate most of it with cron. All you'll have to do is switch out the tapes (or whatever means you use to backup) every so often.

 

graphics/tip.gif

Though it is technically possible to use the archiving commands in this section as a normal user , for the most part you're going to be running them as root.

 

The commands covered in this chapter include the following:

compress

Compress file with Lempel-Ziv encoding

cpio

Archive files

dump

Save an entire filesystem

gzexe

Compress an executable file in place

gzip

Compress a file

gunzip

Uncompress a gzipped file

restore

Restore filesystem saved with dump

shar

Create a shell archive

tar

Pack and unpack archive files.

uncompress

Expand compressed file

uuencode

Encode a file for mail transmission

uudecode

Decode a file encoded with uuencode

zcmp

Compare two zipped files

zdiff

Compare two zipped files

zgrep

Search the contents of zipped file(s)

zmore

Display the contents of zipped file(s)

znew

Convert from compress format to zip format

 

Related Files

/dev/rmt*

Default tape unit to dump to

/etc/dumpdates

Dump date records

/etc/fstab

Dump table, file systems, and frequency

/etc/ group

To find group operator