Compressing files (compress and pack commands)

Use the compress command and the pack command to compress files for storage.

Use the uncompress command and the unpack command to expand the restored files.

The process of compressing and expanding files takes time; however, after the files are packed, the data uses less space on the backup medium.

To compress a file system, use one of the following methods:

Advantages for compressing files include:

  • Saving money and time by compressing files before sending them over a network.
  • Saving storage and archiving system resources:
    • Compress file systems before making backups to preserve tape space.
    • Compress log files created by shell scripts that run at night; it is easy to have the script compress the file before it exits.
    • Compress files that are not currently being accessed. For example, the files belonging to a user who is away for extended leave can be compressed and placed into a tar archive on disk or to a tape and later be restored.
Note:
  • The compress command might run out of working space in the file system while compressing. The command creates the compressed files before it deletes any of the uncompressed files, so it needs a space about 50% larger than the total size of the files.
  • A file might fail to compress because it is already compressed. If the compress command cannot reduce file sizes, the command fails.

See the compress command for details about the return values but, in general, the problems encountered when compressing files can be summarized as follows:

  • The command might run out of working space in the file system while compressing. Because the compress command creates the compressed files before it deletes any of the uncompressed files, it needs extra space-from 50% to 100% of the size of any given file.
  • A file might fail to compress because it is already compressed. If the compress command cannot reduce the file size, it fails.