Backing Up and Restoring - Pdf 63

Backing Up and Restoring
Objectives
Upon completion of this module, you should be able to:
• Use the tar and compress commands to back up files and directories
• Use the jar command to save and compress files and directories
• Position a tape to a selected data set using the mt utility
Discussion – How frequently do you back up or restore files?
Contents Overview
In order to back up or easily transfer files via ftp or another method, you need to be able to
package and restore the files easily. This module covers the following commands:
• tar
• compress
• jar
• mt
In addition, specific instructions for backing up and restoring your home directory using tar
and compress are included.
The tar Command
The tar (tape archive) command enables you to back up single or multiple files in a directory
hierarchy.
Command Format
tar function_[letter/modifier] [output file]
filename(s)/directory(s)
Function Letters
c Create a new tar file
t List the table of contents of the tar file
x Extract the specified files from the tar file
Function Modifiers
f Specify the tar file ( /tmp/file.tar) or tape
drive (/dev/rmt/x) if other than default
v Execute in verbose mode
Saving a Directory to Tape

Compressing a File
The following example uses the -v (verbose) option to compress a file called
bin.file:
The file is compressed and a .Z suffix is appended to the file name.
$ compress -v bin.file
bin.file: Compression: 70.84% -- replaced with
bin.file.Z
Files are uncompressed using the uncompress command.
Command Format: Uncompressing
uncompress filename
Uncompressing a File
$ uncompress bin.file.Z
The jar Command
The jar command is similar to the tar command, but compresses the resulting file in the
same step. It is a Java™ application that combines multiple files into a single JAR (Java archive)
file. It is also a generalpurpose archiving and compression tool, based on ZIP and the ZLIB
compression format. The jar command was originally created for Java programmers to
download multiple files with one request, rather than having to issue a download request for each
separate file. jar is standard with the Linux operating system, but is available on any system
that has Java virtual machine (JVM) installed.
Command Format
The syntax for the jar tool is almost identical to the syntax for the tar
command.
jar options [ output file ] filename(s)/directory(s)
Options
c Create a new jar file
t List the table of contents of the jar file
x Extract the specified files from the jar file
f Specify the jar file ( /tmp/file.jar) or tape drive (/dev/rmt/x) if other
than default

status Displays status information about the tape drive.
rewind Rewinds the tape.
retension Rewinds the cartridge tape completely, winds
the tape forward to the end of the tape, then
rewinds back to the beginning of the tape to
smooth out the tape tension.
erase Erases the entire tape.
fsf Forward skips count tape files.
bsf Backward skips count tape files.
eom Skips to the end of the recorded media.
off Ejects 4- or 8-mm tapes.
Note – Only the unique prefix of a command is required. For example,
use ret in place of retension.
Use the following mt command to rewind a tape:
$ mt rew
To have the tape skip forward a tape file, use the following command:
$ mt -f /dev/rmt/0n fsf 1
The device name /dev/rmt/0n tells the tape drive not to rewind the tape after it has
performed a function. This device naming convention can also be used when archiving
files with tar and jar.
Note – The retension option does not work with 8-mm tapes.


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status