OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

1.3. Restoring from the Archive


Once an archive has been created it is important to test the archive. The archive can be tested by listing the files it contains, but the best test is to restore a file from the archive.

• To see a listing of the archive contents. From a terminal prompt type:


tar -tzvf /mnt/backup/host-Monday.tgz

• To restore a file from the archive to a different directory enter:



tar -xzvf /mnt/backup/host-Monday.tgz -C /tmp etc/hosts


The -C option to tar redirects the extracted files to the specified directory. The above example will extract the /etc/hosts file to /tmp/etc/hosts. tar recreates the directory structure that it contains.


Also, notice the leading "/" is left off the path of the file to restore.

• To restore all files in the archive enter the following:


cd /

sudo tar -xzvf /mnt/backup/host-Monday.tgz


image

This will overwrite the files currently on the file system.


Top OS Cloud Computing at OnWorks: