Archives files to tar files, often on backup tapes. In Unix, a tape isnt always a tape--in this instance, it may be a tape, hard disk, or diskette. Specified files
can either replace existing files or be appended to existing files. Tar is also used to extract archived files from tape.
The usage for the tar command differs slightly from the rest of the unix
command set. Options have two parts: a function option, each command must contain one of these, followed by other options. In addtion, the hyphen (-) is not needed before options.
# tar cvf /dev/mt0 /usr/home/jack/memos
This creates a new archieve of all files in the directory /usr/home/jack/memos on the device /dev/mt0: Remember that devices in unix are
treated as files.
# tar xvf /dev/mt0 `memo*`
This extracts all files beginning with memo from the tape in /dev/mt0
c Creates a new tar archieve
r Appends files to the end of the archive
t Prints out a table of contents
u Updates archive by appending file(s) if not on the tape if modified
x Extracts files from within the tar archive
bn Sets blocking factor to n (default is 1; maximum is 64)
fdev Writes archive to dev; default is /dev/mt0 on many systems
I Returns error messages about links that cannot be read
L Follows symbolic links
m Updates file-modification times to the time of extraction
o Changes ownership of extracted files to the current user. This is very
useful if the archive was made by another user.
v Verbose mode: Prints out status information
w Waits for confirmation
Backing up data on a tape drive using TAR :
If you are wanting to do a backup of your Unix machine, you can do this with the TAR command. If the device is "rst0", if you
dont know, do a dmesg and look for the device. And substitute it with the "rst0" that we are using here for the example :.
If you are wanting to backup the whole machine, make sure that you are in
the "/" directory, to do this make sure you do "cd /", this will take you to the "/" directorty.
To do the whole machine backup do the following command :
"tar -zpcvf /dev/rsto . "
NOTE: The key is to not forget the period at the end of that command...