517 lines
11 KiB
HTML
517 lines
11 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Server Restore Procedures</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
|
|
"><LINK
|
|
REL="HOME"
|
|
TITLE="Linux Administration Made Easy"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Backup and Restore Procedures"
|
|
HREF="backup-and-restore.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Server Backup Procedures"
|
|
HREF="server-backup.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Cisco Router Configuration Backups"
|
|
HREF="router-configuration.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Linux Administration Made Easy</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="server-backup.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 8. Backup and Restore Procedures</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="router-configuration.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="SERVER-RESTORE"
|
|
>8.2. Server Restore Procedures</A
|
|
></H1
|
|
><P
|
|
>Unarguably, the one thing that is more important than performing
|
|
regular backups is having them available when it comes time to recover an
|
|
important file!</P
|
|
><P
|
|
>Obviously, as discussed in <A
|
|
HREF="server-backup.html"
|
|
>Section 8.1</A
|
|
>, the
|
|
procedures for performing a restore will differ depending on your choice
|
|
of a backup solution. In this section, I will discuss methods for
|
|
restoring files which have been backed up with ``tar'' and
|
|
''KDat''.</P
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="TAR-RESTORE"
|
|
>8.2.1. Restoring with ``tar'':</A
|
|
></H2
|
|
><P
|
|
>The following command will restore all files from the
|
|
``<TT
|
|
CLASS="LITERAL"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>full-backup-09-October-1999.tar.gz</TT
|
|
></TT
|
|
>''
|
|
archive, which is an example backup of our Linux system (as created in the
|
|
example commands shown in <A
|
|
HREF="server-backup.html#TAR-BACKUP"
|
|
>Section 8.1.1</A
|
|
>:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
><TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>tar -zxvpf /archive/full-backup-09-October-1999.tar.gz</B
|
|
></TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>The above command extracts all files contained in the compressed
|
|
archive, preserving original file ownership and permissions. The
|
|
``<TT
|
|
CLASS="LITERAL"
|
|
>x</TT
|
|
>'' option stands for extract. (The other options
|
|
are described in <A
|
|
HREF="server-backup.html#TAR-BACKUP"
|
|
>Section 8.1.1</A
|
|
>.</P
|
|
><DIV
|
|
CLASS="CAUTION"
|
|
><P
|
|
></P
|
|
><TABLE
|
|
CLASS="CAUTION"
|
|
BORDER="1"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
ALIGN="CENTER"
|
|
><B
|
|
>Caution</B
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
ALIGN="LEFT"
|
|
><P
|
|
>Caution: Extracting files from a tar archive can be a
|
|
dangerous thing to do, and should therefore be done with caution.
|
|
Perhaps the files were not archived without a file path prepended (a few
|
|
misguided or uninformed developers distribute tarballs of their software
|
|
offerings like this), meaning they will all be extracted into the current
|
|
directory. Perhaps the files were archived with leading
|
|
``<TT
|
|
CLASS="LITERAL"
|
|
>/</TT
|
|
>'' slashes (by specify the
|
|
``<TT
|
|
CLASS="LITERAL"
|
|
>--absolute-paths</TT
|
|
>'' option when the archive was
|
|
created), meaning the files will be restored to their absolute locations
|
|
(even if you didn't want them to be). Or, perhaps the files were archived
|
|
<EM
|
|
>without</EM
|
|
> leading ``<TT
|
|
CLASS="LITERAL"
|
|
>/</TT
|
|
>'' slashes,
|
|
meaning the files will be restored under the current directory (even if
|
|
you didn't want them to be). This of course, depends on how the backup
|
|
was created. For this reason, I strongly recommend testing your ``tar''
|
|
command with a ``<TT
|
|
CLASS="LITERAL"
|
|
>t</TT
|
|
>'' (<EM
|
|
>type</EM
|
|
>) option
|
|
<EM
|
|
>first,</EM
|
|
> and then replace the ``<TT
|
|
CLASS="LITERAL"
|
|
>t</TT
|
|
>''
|
|
with an ``<TT
|
|
CLASS="LITERAL"
|
|
>x</TT
|
|
>'' (<EM
|
|
>extract</EM
|
|
>) when you
|
|
are absolutely sure the command will do what you expect it
|
|
to.</P
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
><P
|
|
>If you do not need to restore all files contained in the archive,
|
|
you can specify one or more files that you wish to restore, as in the
|
|
following example:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
><TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>tar -zxvpf /archive/full-backup-09-October-1999.tar.gz \
|
|
etc/profile usr/local/bin/tolower</B
|
|
></TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>The above command restores the
|
|
``<TT
|
|
CLASS="LITERAL"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>etc/profile</TT
|
|
></TT
|
|
>'' and
|
|
``<TT
|
|
CLASS="LITERAL"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>usr/local/bin/tolower</TT
|
|
></TT
|
|
>'' files
|
|
from the example archive.</P
|
|
><DIV
|
|
CLASS="TIP"
|
|
><BLOCKQUOTE
|
|
CLASS="TIP"
|
|
><P
|
|
><B
|
|
>Tip: </B
|
|
>If you are trying to restore only one or a few files from
|
|
your archive, you will not be successful unless you specify the <
|
|
file name and directory path <EM
|
|
>exactly</EM
|
|
> as stored in
|
|
the archive. The following example might help out:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><PRE
|
|
CLASS="SCREEN"
|
|
><TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>tar -ztvpf /archive/full-backup-09-October-1999.tar.gz \
|
|
| grep -i profile</B
|
|
></TT
|
|
></PRE
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>In the above example, all files contained in the archive are listed
|
|
by file name. The resulting output is then piped to the
|
|
``<TT
|
|
CLASS="LITERAL"
|
|
>grep</TT
|
|
>'' command (using grep's ``<TT
|
|
CLASS="LITERAL"
|
|
>i</TT
|
|
>''
|
|
option to ignore mixed case), displaying any files containing ``profile''
|
|
in either the directory path or file name. Once you determine the exact
|
|
file name you wish to restore, you can then specify it for extraction in
|
|
a regular tar command expression.</P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
><P
|
|
>As mentioned in <A
|
|
HREF="server-backup.html"
|
|
>Section 8.1</A
|
|
>, when creating an
|
|
archive file, tar will strip leading ``<TT
|
|
CLASS="LITERAL"
|
|
>/</TT
|
|
>'' (slash)
|
|
characters from file path names. This means that restore files may not
|
|
end up in the same locations they were backed up from. Therefore, either
|
|
change to the ``<TT
|
|
CLASS="LITERAL"
|
|
><TT
|
|
CLASS="FILENAME"
|
|
>/</TT
|
|
></TT
|
|
>'' root
|
|
directory, or use the ``<TT
|
|
CLASS="LITERAL"
|
|
>--directory /</TT
|
|
>'' option.</P
|
|
><DIV
|
|
CLASS="NOTE"
|
|
><BLOCKQUOTE
|
|
CLASS="NOTE"
|
|
><P
|
|
><B
|
|
>Note: </B
|
|
>Note: A far safer solution is to restore the desired files under a
|
|
different directory (for example, your home directory), and then compare,
|
|
move, or update the files to their original locations afterward.</P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="KDAT-RESTORE"
|
|
>8.2.2. Restoring with ``KDat'':</A
|
|
></H2
|
|
><P
|
|
>To restore one or more files from a KDat-created backup set, insert
|
|
the backup tape into the drive, choose <SPAN
|
|
CLASS="QUOTE"
|
|
>"<TT
|
|
CLASS="LITERAL"
|
|
>Mount
|
|
Tape</TT
|
|
>"</SPAN
|
|
> from the <SPAN
|
|
CLASS="QUOTE"
|
|
>"<TT
|
|
CLASS="LITERAL"
|
|
>File</TT
|
|
>"</SPAN
|
|
>
|
|
menu option (or left-click on the icon that looks like a tape).</P
|
|
><P
|
|
>KDat will try to read header information from the tape, and if
|
|
successful, will then try to find the tape index which matches the
|
|
identification found in the tape header. This tape index is stored on
|
|
your hard drive, and is a unique file created for each backup tape
|
|
formatted by KDat, and is updated each time you perform a backup.</P
|
|
><P
|
|
>If this corresponding tape index is missing (perhaps you are
|
|
restoring from a backup set created on another machine, or the index file
|
|
was deleted or somehow corrupted on your hard drive), KDat will inform you
|
|
of this fact, and ask you if it is okay to recreate the index by reading
|
|
the tape. Because you will need to recreate it before you will be able to
|
|
restore your desired files, it makes perfect sense to left-click
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"Yes"</SPAN
|
|
>.</P
|
|
><DIV
|
|
CLASS="NOTE"
|
|
><BLOCKQUOTE
|
|
CLASS="NOTE"
|
|
><P
|
|
><B
|
|
>Note: </B
|
|
>(Note: Once a tape is reindexed, its name is changed to
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<EM
|
|
>Reindexed Tape</EM
|
|
>"</SPAN
|
|
>. You should rename the
|
|
tape to its original name.)</P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
><P
|
|
>Once the tape index has been successfully read, it can then used to
|
|
select the directories or files you wish to restore from the backup set,
|
|
in much the same manner you used when creating your backup profiles (see
|
|
<A
|
|
HREF="server-backup.html"
|
|
>Section 8.1</A
|
|
> for detailed instructions on the file
|
|
selection process).</P
|
|
><P
|
|
>Once you have selected the appropriate files, you can start the
|
|
restoration process by choosing
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<TT
|
|
CLASS="LITERAL"
|
|
>Restore...</TT
|
|
>"</SPAN
|
|
> from the <SPAN
|
|
CLASS="QUOTE"
|
|
>"File"</SPAN
|
|
>
|
|
option on the menu bar (or left-click the tape restore icon). KDat will
|
|
display a dialog box, allowing you to confirm which files will be
|
|
restored. In addition, you have the option of specifying a directory
|
|
into which files will be restored. This will allow you to restore
|
|
critical system files into your home directory, and then compare, move,
|
|
or update those files to their intended location later on. This is
|
|
actually the safest way of restoring files.</P
|
|
><P
|
|
>To begin the recovery process, click the
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<TT
|
|
CLASS="LITERAL"
|
|
>Okay</TT
|
|
>"</SPAN
|
|
> button. KDat will then scan the
|
|
tape and restore the selected files.</P
|
|
><P
|
|
>On occasion, you may find it necessary or useful to restore one or
|
|
more files from a backup set created with KDat
|
|
<EM
|
|
>without</EM
|
|
> using KDat to do so. Perhaps you would like
|
|
to restore such files on a system that does not offer a GUI-based
|
|
environment, or would like to do so over a slow network connection through
|
|
which remote execution of KDat would be impractical. Fortunately, KDat
|
|
writes its backup data sets using the ``tar'' tool, a command-line based
|
|
tool that is available on any *nix system.</P
|
|
><P
|
|
>Should you wish to restore your KDat-created backup set using tar, simply
|
|
do so using whatever options you would with any normal backup set created
|
|
with tar itself. Bear in mind, however, that data sets are not stored
|
|
in compressed format.</P
|
|
><DIV
|
|
CLASS="NOTE"
|
|
><BLOCKQUOTE
|
|
CLASS="NOTE"
|
|
><P
|
|
><B
|
|
>Note: </B
|
|
>Note: You will almost certainly get an error message when trying to
|
|
access the KDat backup set with tar. This is because of the header and
|
|
other information that KDat added to the tape when it was first formatted.
|
|
Simply repeat the tar command two or three times to skip to the beginning
|
|
of the actual tar archive file.</P
|
|
></BLOCKQUOTE
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="server-backup.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="router-configuration.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Server Backup Procedures</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="backup-and-restore.html"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Cisco Router Configuration Backups</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |