ITEM: AH8119L

General questions on tar and mksysb archives


QUESTION: 

What tar commands should I use on a tar archive or 
mksysb to display the files contained in the archive.  Also, how 
do I extract a part or all of the archive?  Finally, what is the 
difference between a relative and absolute backup?

ANSWER:

 A mksysb has 3 boot images and then a large tar image of
the files in the mounted rootvg JFS filesystems.  A straight tar
backup obviously won't have boot images.  Once the mksysb is fast-
forwarded over the 3 boot images, all of the following tar commands
apply to a mksysb tape or tar archive:

To fast forward a MKSYSB over the boot images:

 tctl -f/dev/rmt0 rewind
 tctl -f/dev/rmt0.1 fsf 3     ( YOU MUST USE A NO-REWIND DEVICE )

To get a table of contents of a tar archive:

 tar -tvf/dev/rmt0

To restore the entire archive:

 tar -xvf/dev/rmt0

To restore a file or directory:

 tar -xvf/dev/rmt0 ./\ ./\
 (you can list as many file or directories as desired)

When restoring files, it is important to know if the backup is a
relative or absolute path.  Files in a RELATIVE backup will be listed
in one of two ways during a "tar -tvf..":

 -rw-r--r--   1 bin      bin         9999 Jul 30 1993  ./filename

or

 -rw-r--r--   1 bin      bin         9999 Jul 30 1993  filename

Note that the only difference in the 2 lines above are that the first
filename has a ./ in front of it and the second doesn't.  Both of
these backups when restored will restore the files to the directory
you are in when the "tar -xvf.." is run.  If a full pathname is listed
such as ./tmp/filename, the path will be built from the current
directory.  Files in a mksysb backup are in the ./\/\
format.

Files in an ABSOLUTE backup will be listed in the following manner:

 -rw-r--r--   1 bin      bin         9999 Jul 30 1993  /tmp/filename

In this example, the filename will always be restored to the /tmp
directory regardless of which directory you are in when the restore is
ran.  However, by using the pax command to restore an absolute tar
backup, you can change the destination of the restored file.  For
example, if you had an absolute archive of /tmp/testfile and you
wanted it restored to /home/testfile, you could use the following
pax command to restore the tar archive file:

 pax -rvf/dev/rmt0 -s !/tmp/testfile/!/home/testfile/! -pmop /tmp/tesfile

The above command would restore /tmp/testfile to /home/testfile even
though it is an absolute tar archive.

The type of archive (relative vs. absolute) is determined by how the
archive was made.  Examples of the 3 possibilities are shown below:

From the / directory:

 Two forms of RELATIVE archives:
  tar -cvf/dev/rmt0 usr         Files backed up as: usr/bin/\

  tar -cvf/dev/rmt0 ./usr       Files backed up as: ./usr/bin/\

 The ABSOLUTE archive:
  tar -cvf/dev/rmt0 /usr        Files backed up as: /usr/bin/\

A mksysb, as mentioned above, is in the second relative archive form.



Support Line: General questions on tar and mksysb archives ITEM: AH8119L
Dated: April 1995 Category: N/A
This HTML file was generated 99/06/24~13:30:27
Comments or suggestions? Contact us