Untar of Backup Files

Review of Previous Material

The backup files are stored on piemonte under the directories /backup/systemname , for example "/backup/monviso". From the local system it appears as simply "/backup".

A typical name is monviso-020405.tar.gz , meaning it is a gzipped tar file made on 2002-April-5.

You must gunzip the file before you can untar it.

The tar file contains all the locally mounted filesystems. It does not contain remote filesystems, CD-ROMs, etc.

The tar file contains absolute paths . When you un-tar it, the files will overwrite your own files, since they will un-tar into absolute locations.

(Note: Absolute paths happen to be how we created our backup files; other tar files may have relative paths.)

How to examine and extract files from a backup file.

The relevant tar commands are as follows. Note that important info regarding chroot is coming up.

tar tvf filename.tar (List the contents of the tar file)
tar xvf filename.tar file1 file2 ... (extract the named files and directories)
tar xvf filename.tar (extract and list the contents)
tar xf filename.tar (extract the contents of the whole tar file, silently)

In the form of the tar command to extract named files, you must put the full path as it appears in the tar file. In other words,

tar xvf /etc/hosts
would be correct, but not
tar xvf etc/hosts (wrong)
tar xvf hosts (wrong)
When in doubt, use a tar tvf command to examine the path stored in the tar file.

If you name a directory to extract, it will take the whole directory subtree and all its files.

The Magic Chroot Command

The chroot command exists to trick the tar command to write into relative locations:

chroot /tmp tar xvf tarfile.tar /space/mglass/proj1

This will extact the directory tree /space/mglass/proj1 and place it relative to /tmp, producing /tmp/space/mglass/proj1.

You must be logged in as root to run chroot.

Home

Last Revised: 15 May 2002
Michael Glass