z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Backing up and restoring files from the shell

z/OS UNIX System Services User's Guide
SA23-2279-00

This information describes how to use the pax or tar utilities to back up and restore files. The purpose of both utilities is to store the data and attributes of one or more component files into a single file, referred to as the archive file. pax is considered to be the standard utility for managing archive files, replacing tar; therefore, pax is used as the default utility in the examples that follow. However, tar is still widely used, and in the z/OS® environment provides practically equivalent function. Therefore, the corresponding tar commands are also shown.

Both pax and tar support multiple archive formats and options that allow a greater or lesser degree of file characteristics to be preserved. The USTAR format allows the most information to be saved, therefore it is used as the default format in the examples that follow. For more information about the USTAR and other archive formats, refer to z/OS UNIX System Services Command Reference. Because both pax and tar can read and write archives in USTAR format, either utility can be used to restore an archive that was created by the other. The significant difference between the two utilities is that only pax can perform code page conversion on files during creation of, or extraction from, an archive. Users of tar can use the iconv utility to perform the same conversion on files as a separate step.

Both pax and tar support inline compression and decompression of files. Because compressed archives occupy an average of 50-60% percent of the uncompressed archive, many of the examples shown here use compression. Note that compressed archives are not guaranteed to be portable to other UNIX systems.

Archives can be copied to an MVS™ data set using the TSO/E OGET command and later copied back to the file system using the TSO/E OPUT command. For OS/390® Release 8 and later, pax and tar can read and write archives that reside in an MVS data set, making it unnecessary to first manually move files between the file system and MVS using OGET or OPUT.

pax and tar support file names and link names that exceed 100 characters in length. The utilities remain compatible with other UNIX systems and with previous versions of OS/390.

The remainder of this topic describes the following specific steps for backing up and restoring files to and from an MVS data set and performing other related archive management tasks.
  • Backing up a complete directory into an MVS data set
  • Restoring a complete directory from an MVS data set
  • Viewing the contents of an archive
  • Converting between code pages
  • Appending to an existing archive
  • Storing selected files into an archive
  • Restoring selected files from an archive
  • Appending to an existing archive
  • Backing up selected files by date

These examples demonstrate the most common tasks related to backing up and restoring files, and do not attempt to describe all of the options of the pax and tar utilities. See z/OS UNIX System Services Command Reference for a complete description of pax and tar.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014