Creating Your Own Tape Archive (tar) File


How do developers create those compressed tape archive files? In this section, we'll provide brief instructions using your kernel source files as an example.

First, place all of the files into the tar file with the command:

 #tar cvf /tmp/kernellibs.2.6.x.tar /lib/modules/2.6.x 

This command takes all of the files and all subdirectories of files and places them into the file /tmp/kernellibs.2.6.x.tar (leaving the original files untouched).

To reassure yourself that this tape archive file really contains all of your files and directories, you can list the contents of the file (without untarring it) with the command:

 #tar tvf /tmp/kernellibs.2.6.x.tar 

You can then compress this file with one of the following compression methods:

 #compress /tmp/kernellibs.2.6.x.tar #gzip /tmp/kernellibs.2.6.x.tar #bzip2 /tmp/kernellibs.2.6.x.tar 

This will change the name of the file and add the proper extension to indicate the type of compression you selected.

You can then copy these files over to the destination system and uncompress and untar them using the commands in the previous section.[1]

[1]Note that an easier method to accomplish the same thing when you are the administrator of both hosts is to use the scp or secure copy command with the -r option. See the scp man page for more information.



The Linux Enterprise Cluster. Build a Highly Available Cluster with Commodity Hardware and Free Software
Linux Enterprise Cluster: Build a Highly Available Cluster with Commodity Hardware and Free Software
ISBN: 1593270364
EAN: 2147483647
Year: 2003
Pages: 219
Authors: Karl Kopper

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net