Added "System recovery with Knoppix" to resources section.

This commit is contained in:
ccurley 2003-11-03 19:55:30 +00:00
parent 10629ed960
commit 0b3f742729
1 changed files with 169 additions and 326 deletions

View File

@ -17,10 +17,10 @@
<!ENTITY longversion "$Header$">
<!entity myemail "charlescurley at charlescurley dot com">
<!entity myurl "http://www.charlescurley.com">
<!ENTITY myemail "charlescurley at charlescurley dot com">
<!ENTITY myurl "http://www.charlescurley.com">
<!entity % review "IGNORE">
<!ENTITY % review "IGNORE">
]>
@ -50,9 +50,7 @@ Change notes:
<article lang="en" id="index">
<articleinfo>
<title>Linux Complete Backup and Recovery HOWTO</title>
<date>
2002 January 20
</date>
<date>2002 January 20</date>
<author>
@ -75,6 +73,12 @@ Change notes:
<!-- <authorinitials>c^2</authorinitials> -->
<!-- <revremark></revremark> -->
<!-- </revision> -->
<revision>
<revnumber>1.4</revnumber>
<date>2003-08-17</date>
<authorinitials>c^2</authorinitials>
<revremark>Some notes on burning CD-ROMs, and more on files to exclude.</revremark>
</revision>
<revision>
<revnumber>1.3</revnumber>
<date>2003-04-24</date>
@ -147,7 +151,7 @@ Change notes:
<sect2 id="copyright">
<title>Copyright Information</title>
<para>Copyright &copy; 2001, 2002 Charles Curley and distributed under the terms of the GNU Free Documentation License (GFDL) license, stated below. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled <link linkend="appendix1gfdl"><quote>GNU Free Documentation License</quote></link>. </para>
<para>Copyright &copy; 2001, 2002, 2003 Charles Curley and distributed under the terms of the GNU Free Documentation License (GFDL) license, stated below. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled <link linkend="appendix1gfdl"><quote>GNU Free Documentation License</quote></link>.</para>
<!-- <para> -->
<!-- Unless otherwise stated, Linux HOWTO documents are -->
@ -176,45 +180,33 @@ Change notes:
<!-- be notified of any plans to redistribute the HOWTOs. -->
<!-- </para> -->
<para>If you have any questions, please contact <email>linux-howto at metalab.unc.edu</email>. </para>
<para>If you have any questions, please contact <email>linux-howto at metalab.unc.edu</email>.</para>
</sect2>
<sect2 id="disclaimers">
<title>Disclaimers</title>
<para> No liability for the contents of this documents can be accepted by the author, the <ulink url="http://www.tldp.org/">Linux Documentation Project</ulink> or anyone else. Use the concepts, examples and other content at your own risk. There may be errors and inaccuracies that may be damaging to your system. Proceed with caution, and although errors are unlikely, the author(s) take no responsibility for them. </para>
<para> No liability for the contents of this documents can be accepted by the author, the <ulink url="http://www.tldp.org/">Linux Documentation Project</ulink> or anyone else. Use the concepts, examples and other content at your own risk. There may be errors and inaccuracies that may damage your system. Proceed with caution, and, although errors are unlikely, the author take no responsibility for them.</para>
<para> All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. </para>
<para> All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark.</para>
<para>
Naming of particular products or brands should not be seen
as endorsements.
</para>
<para>Naming of particular products or brands should not be seen as endorsements.</para>
<para>
You are strongly recommended to take a backup of your system
before major installation and backups at regular intervals.
</para>
<para>In addition, you are strongly recommended to use a sacrificial experimental computer when mucking with the material, espcially the scripts, in this HOWTO.</para>
<para>You are strongly recommended to take a backup of your system before major installation and backups at regular intervals. In addition, you are strongly recommended to use a sacrificial experimental computer when mucking with the material, especially the scripts, in this HOWTO.</para>
</sect2>
<sect2 id="newversions">
<title>New Versions</title>
<para>You can find this document at its <ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO.html">home page</ulink> or at the <ulink url="http://www.tldp.org/">Linux Documentation Project</ulink> homepage in many formats. Please comment to <email>&myemail;</email></para>
<para>You can find this document at its <ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO.html">home page</ulink> or at the <ulink url="http://www.tldp.org/">Linux Documentation Project</ulink> web site in many formats. Please comment to <email>&myemail;</email></para>
<para>Depending on your browser, you may have to hold down the shift button while you click on these in order to get them to download.</para>
<itemizedlist>
<listitem>
<para>
<ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.chunky.html.tar.bz2">bzip2 compressed chunky (lots of small pages. Faster reading.) HTML</ulink>.
</para>
<para><ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.chunky.html.tar.bz2">bzip2 compressed chunky (lots of small pages. Faster reading.) HTML</ulink>.</para>
</listitem>
<listitem>
<para>
<ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.smooth.html.tar.bz2">bzip2 compressed smooth (one monster page -- no chunks. Easier to search.) HTML</ulink>.
</para>
<para><ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.smooth.html.tar.bz2">bzip2 compressed smooth (one monster page -- no chunks. Easier to search.) HTML</ulink>.</para>
</listitem>
<!-- <listitem> -->
@ -224,21 +216,15 @@ Change notes:
<!-- </listitem> -->
<listitem>
<para>
<ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.ps.bz2">bzip2 compressed postscript (US letter format)</ulink>.
</para>
<para><ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.ps.bz2">bzip2 compressed postscript (US letter format)</ulink>.</para>
</listitem>
<listitem>
<para>
<ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.pdf.bz2">bzip2 compressed PDF (US letter format)</ulink>.
</para>
<para><ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.pdf.bz2">bzip2 compressed PDF (US letter format)</ulink>.</para>
</listitem>
<listitem>
<para>
<ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.txt.bz2">bzip2 compressed raw ASCII text</ulink>.
</para>
<para><ulink url="&myurl;/Linux-Complete-Backup-and-Recovery-HOWTO/Linux-Complete-Backup-and-Recovery-HOWTO.txt.bz2">bzip2 compressed raw ASCII text</ulink>.</para>
</listitem>
<listitem>
@ -261,13 +247,7 @@ Change notes:
<sect2 id="credits">
<title>Credits</title>
<para>
This document is derived from two articles originally published in
<ulink url="http://www.linuxjournal.com/"><citetitle
pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<citetitle pubwork="journal">Linux Journal</citetitle> for reverting the rights to those articles, thereby helping make this HOWTO possible.
</para>
<para>This document is derived from two articles originally published in <ulink url="http://www.linuxjournal.com/"><citetitle pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to <citetitle pubwork="journal">Linux Journal</citetitle> for reverting the rights to those articles, thereby helping make this HOWTO possible.</para>
<para>Thanks to Joy Y Goodreau for excellent HOWTO editing.</para>
<!-- <para> -->
@ -302,9 +282,7 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<sect2 id="translations">
<title>Translations</title>
<para>
Not everyone speaks English. Volunteers are welcome.
</para>
<para>Not everyone speaks English. Volunteers are welcome.</para>
<!-- <para> -->
<!-- <itemizedlist> -->
@ -337,67 +315,37 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<sect1 id="Overview">
<title>Overview</title>
<para>
The process shown below is not easy, and can be hazardous to your data. Practice it before you need it! Do as I did, and <emphasis>practice on a sacrificial computer</emphasis>!
</para>
<para>
The target computer for this HOWTO is a Pentium computer with a <ulink url="http://www.redhat.com">Red Hat</ulink> 7.1 Linux server or workstation installation on one IDE hard drive. The target computer does not have vast amounts of data because the computer was set up as a <quote>sacrificial</quote> test bed. That is, I did not want to test this process with a production computer and production data. Also, I did a fresh installation before I started the testing so that I could always re-install if I needed to revert to a known configuration.
</para>
<para>The process shown below is not easy, and can be hazardous to your data. Practice it before you need it! Do as I did, and <emphasis>practice on a sacrificial computer</emphasis>!</para>
<para>The target computer for this HOWTO is a Pentium computer with a <ulink url="http://www.redhat.com">Red Hat</ulink> 7.1 Linux server or workstation installation on one IDE hard drive. The target computer does not have vast amounts of data because the computer was set up as a <quote>sacrificial</quote> test bed. That is, I did not want to test this process with a production computer and production data. Also, I did a fresh installation before I started the testing so that I could always re-install if I needed to revert to a known configuration.</para>
<note>
<title>NOTE</title><para>The sample commands will show, in most cases, what I had to type to recover the target system. You may have to use similar commands, but with different parameters. It is up to you to be sure you duplicate your setup, and not the test computer's setup.</para>
</note>
<para>
The basic procedure is set out in W. Curtis Preston, <ulink url="http://www.oreilly.com/catalog/unixbr/"><citetitle pubwork="book">Unix Backup &amp; Recovery</citetitle></ulink>, O'Reilly &amp; Associates, 1999, which I have favorably reviewed in <ulink url="http://www2.linuxjournal.com/lj-issues/issue78/3839.html"><citetitle pubwork="journal">Linux Journal</citetitle></ulink>. However, the book is a bit thin on specific, real-time questions. For example, exactly which files do you back up? What metadata do you need to preserve, and how?
</para>
<para>
Before beginning the process set forth in this HOWTO you will need to back up your system with a typical backup tool such as Amanda, <trademark class="trade">BRU</trademark>, tar, <trademark class="registered">Arkeia</trademark> or cpio. The question, then, is how to get from toasted hardware to the point where you can run the restoration tool that will restore your data.
</para>
<para>
Users of Red Hat Package Manager (RPM) based Linux distributions should also save RPM metadata as part of their normal backups. Something like:
</para>
<para>The basic procedure is set out in W. Curtis Preston, <ulink url="http://www.oreilly.com/catalog/unixbr/"><citetitle pubwork="book">Unix Backup &amp; Recovery</citetitle></ulink>, O'Reilly &amp; Associates, 1999, which I have favorably reviewed in <ulink url="http://www2.linuxjournal.com/lj-issues/issue78/3839.html"><citetitle pubwork="journal">Linux Journal</citetitle></ulink>. However, the book is a bit thin on specific, real-time questions. For example, exactly which files do you back up? What metadata do you need to preserve, and how?</para>
<para>Before beginning the process set forth in this HOWTO you will need to back up your system with a typical backup tool such as Amanda, <trademark class="trade">BRU</trademark>, tar, <trademark class="registered">Arkeia</trademark> or cpio. The question, then, is how to get from toasted hardware to the point where you can run the restoration tool that will restore your data.</para>
<para>Users of Red Hat Package Manager (RPM) based Linux distributions should also save RPM metadata as part of their normal backups. Something like:</para>
<programlisting>bash# <command>rpm -Va > /etc/rpmVa.txt</command></programlisting>
<para>
in your backup script will give you a basis for comparison after a bare metal restoration.
</para>
<para>
To get to this point, you need to have:
</para>
<para>in your backup script will give you a basis for comparison after a bare metal restoration.</para>
<para>To get to this point, you need to have:</para>
<itemizedlist>
<listitem>
<para>
Your hardware up and running again, with replacement components as needed. The BIOS should be correctly configured, including time and date, and hard drive parameters. At the moment, there is no provision for using a different hard drive.
</para>
<para>Your hardware up and running again, with replacement components as needed. The BIOS should be correctly configured, including time and date, and hard drive parameters. At the moment, there is no provision for using a different hard drive.</para>
</listitem>
<listitem>
<para>
A parallel port <ulink url="http://www.iomega.com/"><trademark class="registered">Iomega</trademark></ulink> <ulink url="http://www.iomega.com/zip/products/par100_250.html"><trademark class="registered">ZIP</trademark> drive</ulink> or equivalent. You will need at least 30 MB of space.</para>
</listitem>
<listitem>
<para>
Your backup media.
</para>
<para>Your backup media.</para>
</listitem>
<listitem>
<para>
A minimal Linux system that will allow you to run the restoration software.
</para>
<para>A minimal Linux system that will allow you to run the restoration software.</para>
</listitem>
</itemizedlist>
<para>
To get there, you need at least two stages of backup, and possibly three. Exactly what you back up and in which stage you back it up is determined by your restoration process. For example, if you are restoring a tape server, you may not need networking during the restoration process. So only back up networking in your regular backups.
</para>
<para>
You will restore in stages as well. In stage one, we build partitions, file systems, etc. and restore a minimal file system from the ZIP disk. The goal of stage one is to be able to boot to a running computer with a network connection, tape drives, restoration software, or whatever we need for stage two.
</para>
<para>
The second stage, if it is necessary, consists of restoring backup software and any relevant databases. For example, suppose you use Arkeia and you are building a bare metal recovery ZIP disk for your backup server. Arkeia keeps a huge database on the server's hard drives. You can recover the database from the tapes, if you want. Instead, why not tar and gzip the whole arkeia directory (at /usr/knox), and save that to another computer over nfs or ssh? Stage one, as we have defined it below, does not include X, so you will have some experimenting to do if you wish to back up X as well as your backup program. Some restore programs require X.
</para>
<para>
Of course, if you are using some other backup program, you may have some detective work to do to. You will have to find out the directories and files it needs to run. If you use tar, gzip, cpio, mt or dd for your backup and recovery tools, they will be saved to and restored from our ZIP disk as part of the stage one process describe below.
</para>
<para>
The last stage is a total restoration from tape or other media. After you have done that last stage, you should be able to boot to a fully restored and operational system.
</para>
<para>To get there, you need at least two stages of backup, and possibly three. Exactly what you back up and in which stage you back it up is determined by your restoration process. For example, if you are restoring a tape server, you may not need networking during the restoration process. So only back up networking in your regular backups.</para>
<para>You will restore in stages as well. In stage one, we build partitions, file systems, etc. and restore a minimal file system from the ZIP disk. The goal of stage one is to be able to boot to a running computer with a network connection, tape drives, restoration software, or whatever we need for stage two.</para>
<para>The second stage, if it is necessary, consists of restoring backup software and any relevant databases. For example, suppose you use Arkeia and you are building a bare metal recovery ZIP disk for your backup server. Arkeia keeps a huge database on the server's hard drives. You can recover the database from the tapes, if you want. Instead, why not tar and gzip the whole arkeia directory (at /usr/knox), and save that to another computer over nfs or ssh? Stage one, as we have defined it below, does not include X, so you will have some experimenting to do if you wish to back up X as well as your backup program. Some restore programs require X.</para>
<para>Of course, if you are using some other backup program, you may have some detective work to do to. You will have to find out the directories and files it needs to run. If you use tar, gzip, cpio, mt or dd for your backup and recovery tools, they will be saved to and restored from our ZIP disk as part of the stage one process describe below.</para>
<para>The last stage is a total restoration from tape or other media. After you have done that last stage, you should be able to boot to a fully restored and operational system.</para>
<sect2 id="limitations">
<title>Limitations</title>
<para>This HOWTO is restricted to making a minimal backup such that, having then restored that backup to new hardware (<quote>bare metal</quote>), you can then use your regular backups to restore a completely working system. This HOWTO does not deal with your regular backups at all.</para>
@ -419,87 +367,71 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<note>
<title>WARNING</title>
<para>
Do your normal backups on their regular schedule. This HOWTO is useless if you don't do that.
</para></note>
<para>
Build yourself a rescue disk. I use <ulink url="http://www.toms.net/rb">tomsrtbt</ulink>. It is well documented and packs a lot of useful tools onto one floppy diskette. There is an active list for it, and the few questions I've had were quickly and accurately answered. I like that in a product my shop may depend on one day.
</para>
<para>
Next, figure out how to do the operating system backup you will need so that you can restore your normal backup. I followed Preston's advice and used an Iomega parallel port ZIP drive. The drives get approximately 90 MB of useful storage to a disk. I need about 85 MB to back up my desktop, so a 100MB ZIP drive may be pushing your luck.
</para>
Do your normal backups on their regular schedule. This HOWTO is useless if you don't do that.</para></note>
<para>Build yourself a rescue disk. I use <ulink url="http://www.toms.net/rb">tomsrtbt</ulink>. It is well documented and packs a lot of useful tools onto one floppy diskette. There is an active list for it, and the few questions I've had were quickly and accurately answered. I like that in a product my shop may depend on one day.</para>
<para>Next, figure out how to do the operating system backup you will need so that you can restore your normal backup. I followed Preston's advice and used an Iomega parallel port ZIP drive. The drives get approximately 90 MB of useful storage to a disk. I need about 85 MB to back up my desktop, so a 100MB ZIP drive may be pushing your luck.</para>
<sect2 id="installingzipdrive">
<title>Installing the ZIP Drive</title>
<para>
Installing the ZIP drive is covered in the <ulink url="http://www.tldp.org/HOWTO/mini/ZIP-Drive.html">ZIP Drive HOWTO</ulink>, available at <ulink url="http://www.tldp.org/">the Linux Documentation Project</ulink> and at its home page, <ulink url="http://www.njtcom.com/dansie/zip-drive.html">http://www.njtcom.com/dansie/zip-drive.html</ulink>.
</para>
<para>Installing the ZIP drive is covered in the <ulink url="http://www.tldp.org/HOWTO/mini/ZIP-Drive.html">ZIP Drive HOWTO</ulink>, available at <ulink url="http://www.tldp.org/">the Linux Documentation Project</ulink> and at its home page, <ulink url="http://www.njtcom.com/dansie/zip-drive.html">http://www.njtcom.com/dansie/zip-drive.html</ulink>. <!-- njt.com: bad hostname 2003 07 25 --></para>
</sect2>
</sect1>
<sect1 id="CreatingtheStage1BackUp">
<title>Creating the Stage 1 Back Up</title>
<para>
Having made your production backups, you need to preserve your partition information so that you can rebuild your partitions.
</para>
<para>
The script <link linkend="make.fdisk"><filename>make.fdisk</filename></link> scans a hard drive for partition information, and saves it in three files. The first is an executable script, called <link linkend="make.dev.hda"><filename>make.dev.x</filename></link> (where <quote>x</quote> is the name of the device file, e.g. hda). Second is <link linkend="mount.dev.hda"><filename>mount.dev.x</filename></link>, which creates mount points and mounts the newly created partitions on them. The last, <link linkend="dev.hda"><filename>dev.x</filename></link>, is the commands necessary for <command>fdisk</command> to build the partitions. You specify which hard drive you want to build scripts for (and thus the file names) by naming the associated device file as the argument to <link linkend="make.fdisk"><filename>make.fdisk</filename></link>. For example, on a typical IDE system,
</para>
<para>Having made your production backups, you need to preserve your partition information so that you can rebuild your partitions.</para>
<para>The script <link linkend="make.fdisk"><filename>make.fdisk</filename></link> scans a hard drive for partition information, and saves it in three files. The first is an executable script, called <link linkend="make.dev.hda"><filename>make.dev.x</filename></link> (where <quote>x</quote> is the name of the device file, e.g. hda). Second is <link linkend="mount.dev.hda"><filename>mount.dev.x</filename></link>, which creates mount points and mounts the newly created partitions on them. The last, <link linkend="dev.hda"><filename>dev.x</filename></link>, is the commands necessary for <command>fdisk</command> to build the partitions. You specify which hard drive you want to build scripts for (and thus the file names) by naming the associated device file as the argument to <link linkend="make.fdisk"><filename>make.fdisk</filename></link>. For example, on a typical IDE system,</para>
<programlisting>bash# <command>make.fdisk /dev/hda</command></programlisting>
<para>
spits out the scripts <link linkend="make.dev.hda"><filename>make.dev.hda</filename></link>, <link linkend="mount.dev.hda"><filename>mount.dev.hda</filename></link> and the input file for <command>fdisk</command>, <link linkend="dev.hda"><filename>dev.hda</filename></link>.</para>
<para>In addition, if <link linkend="make.fdisk"><filename>make.fdisk</filename></link> encounters a FAT partition, it preserves the partition's boot sector in a file named <filename>dev.xy</filename>, where x is the drive's device name (e.g. sdc, hda) and y is the partition number. The boot sector is the first sector, 512 bytes, of the partition. This sector is restored at the same time the partitions are rebuilt, in the script <filename>make.dev.hda</filename></para>
<para>
Fortunately, the price of hard drives is plummeting almost as fast as the public's trust in politicians after an election. So it is good that the output files are text, and allow hand editing. Right now, that's the only way to rebuild on a larger replacement drive. (See the <link linkend="todo">To Do list</link>.)
</para>
<para>
Other metadata are preserved in the script <link linkend="save.metadata"><filename>save.metadata</filename></link>. The script saves the partition information in the file <filename>fdisk.hda</filename> in the root of the ZIP disk. It is a good idea to print this file and your <filename>/etc/fstab</filename> so that you have hard copy should you ever have to restore the partition data manually. You can save a tree by toggling between two virtual consoles, running <command>fdisk</command> in one and catting <filename>/etc/fstab</filename> or <filename>/fdisk.hda</filename> as needed. However, doing so is error prone.
</para>
<para>
You will also want to preserve files relevant to your restoration method. For example, if you use nfs to save your data, you will need to preserve hosts.allow, hosts.deny, exports, etc. Also, if you are using any network-backed restoration process, such as Amanda or Quick Restore, you will need to preserve networking files like HOSTNAME, hosts, etc. and the relevant software tree.
</para>
<para>
The simplest way to handle these and similar questions is to preserve the entire etc directory.
</para>
<para>
There is no way a 100 MB ZIP drive is going to hold a server installation of a modern distribution of Linux. We have to be much more selective than simply preserving the whole kazoo. What files do we need?
</para>
<para>Fortunately, the price of hard drives is plummeting almost as fast as the public's trust in politicians after an election. So it is good that the output files are text, and allow hand editing. Right now, that's the only way to rebuild on a larger replacement drive. (See the <link linkend="todo">To Do list</link>.)</para>
<para>Other metadata are preserved in the script <link linkend="save.metadata"><filename>save.metadata</filename></link>. The script saves the partition information in the file <filename>fdisk.hda</filename> in the root of the ZIP disk. It is a good idea to print this file and your <filename>/etc/fstab</filename> so that you have hard copy should you ever have to restore the partition data manually. You can save a tree by toggling between two virtual consoles, running <command>fdisk</command> in one and catting <filename>/etc/fstab</filename> or <filename>/fdisk.hda</filename> as needed. However, doing so is error prone.</para>
<para>You will also want to preserve files relevant to your restoration method. For example, if you use nfs to save your data, you will need to preserve hosts.allow, hosts.deny, exports, etc. Also, if you are using any network-backed restoration process, such as Amanda or Quick Restore, you will need to preserve networking files like HOSTNAME, hosts, etc. and the relevant software tree.</para>
<para>The simplest way to handle these and similar questions is to preserve the entire etc directory.</para>
<para>There is no way a 100 MB ZIP drive is going to hold a server installation of a modern distribution of Linux. We have to be much more selective than simply preserving the whole kazoo. What files do we need?</para>
<itemizedlist>
<listitem>
<para>
The boot directory.
</para>
<para>The boot directory.</para>
</listitem>
<listitem>
<para>
The /etc directory and subdirectories.
</para>
<para>The /etc directory and subdirectories.</para>
</listitem>
<listitem>
<para>
Directories needed at boot time.
</para>
<para>Directories needed at boot time.</para>
</listitem>
<listitem>
<para>
Device files in /dev.
</para>
<para>Device files in /dev.</para>
</listitem>
</itemizedlist>
<para>
To determine the directories needed at boot, we look at the boot initialization file <filename>/etc/rc.sysinit</filename>. It sets its own path like so:
</para>
<para>To determine the directories needed at boot, we look at the boot initialization file <filename>/etc/rc.sysinit</filename>. It sets its own path like so:</para>
<programlisting><![ CDATA [PATH=/bin:/sbin:/usr/bin:/usr/sbin
]]><![ CDATA [export PATH]]></programlisting>
<para>
Trial and error indicated that we needed some other directories as well, such as /dev. In Linux, you can't do much without device files.
</para>
<para>
In reading the script <link linkend="save.metadata"><filename>save.metadata</filename></link>, note that we aren't necessarily saving files that are called with absolute paths.
</para>
<para>
We may require several iterations of back up, test the bare metal restore, re-install from CD and try again, before we have a working backup script. While I worked on this HOWTO, I made five such iterations before I had a successful restoration. That is one reason why it is essential to use scripts whenever possible. Test thoroughly!
</para>
<para>Trial and error indicated that we needed some other directories as well, such as <filename>/dev</filename>. In Linux, you can't do much without device files.</para>
<para>In reading the script <link linkend="save.metadata"><filename>save.metadata</filename></link>, note that we aren't necessarily saving files that are called with absolute paths.</para>
<para>We may require several iterations of back up, test the bare metal restore, re-install from CD and try again, before we have a working backup script. While I worked on this HOWTO, I made five such iterations before I had a successful restoration. That is one reason why it is essential to use scripts whenever possible. Test thoroughly!</para>
<para>One thing you can do on an RPM based system is use the <command>rpm</command> program to determine which files are where. For example, to get a complete list of the files used by the openssh package, run:</para>
<programlisting>bash# <command>rpm -ql openssh</command></programlisting>
<para>There are somethings you don't need. like the man pages. You can inspect each one and decide whether to back it up or not.</para>
<para>There are some things you don't need. like the man pages. You can inspect each one and decide whether to back it up or not.</para>
<note>
<title>WARNING</title>
<para>The final stage of restoration is run without overwriting previously restored files. This means that the files restored in the first stage are the ones that will be used after full restoration. So update your bare metal backups whenever you update files in these directories!</para>
</note>
<note>
<title>WARNING</title>
<para>The version of <command>tar</command> included in <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> does not preserve ownership when it restores. This may cause problems for applications like <link linkend="amanda">Amanda</link>. A backup and restoration tool, Amanda has several directories owned by its own eponymous user. The solution is:</para>
<itemizedlist>
<listitem>
<para>Note which directories and files are not owned by root.</para>
</listitem>
<listitem>
<para>Note their owners.</para>
</listitem>
<listitem>
<para>Arrange to set the ownership correctly as part of the restoration process. E.g:</para>
<programlisting>bash# <command>chown -R amanda:disk /var/lib/amanda</command></programlisting>
<para>You can also add that line to your scripts for second state restoration, such as <link linkend="restore.tester"><filename>restore.tester</filename></link>.</para>
</listitem>
</itemizedlist>
</note>
<sect2 id="ThemeAndVariations">
<title>Theme And Variations</title>
<sect3>
@ -509,20 +441,31 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<para>My laptop has problems running both a network card and a ZIP drive, so this is the process I use to back it up.</para>
<para>Alternatively, you could build several ZIP disks' worth of backup on the hard drive, and feed them to the system on restore.</para>
</sect3>
<sect3>
<title>CD-ROM</title>
<para>This is similar to the no ZIP drive option above. Save your backups to a directory on your hard drive, as noted. Then use <command>mkisofs</command> to create an ISO 9660 image from that directory, and burn it.</para>
<para>These days many computers come with a CD-ROM drive but no floppy diskette. And floppy drives do fail. So it's a good idea to burn your CD-ROM with a bootable image on it. The bad news is that the <quote>El Torito</quote> format supports 1.2 MB, 1.44 MB and 2.88 MB floppies, and <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> uses a 1.7 MB floppy. The good news is that you can get a 2.88 MB version, <filename>tomsrtbt-2.0.103.ElTorito.288.img</filename>, from the same mirrors where you get the floppy image. Place a <emphasis>copy</emphasis><footnote>
<para>I emphasize copy because <command>mkisofs</command> will mung the file in the directory from which it makes the ISO image.</para>
</footnote>
in the root directory of the backup files. Then use the <command>mkisofs</command> command line option -b to specify <filename>tomsrtbt-2.0.103.ElTorito.288.img</filename> as the boot image file.</para>
<para>The only down side of this process is that many older BIOSes do not support 2.88 MB floppy images on CD-ROMs. Most of those will boot to a <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> floppy.</para>
<para><emphasis>Test</emphasis> your CDs on the drive you will use at restoration time.</para>
</sect3>
<sect3>
<title>Multiple ZIP disks</title>
<para>By splitting up the two first stage scripts, <link linkend="restore.metadata"><filename>restore.metadata</filename></link> and <link linkend="save.metadata"><filename>save.metadata</filename></link>, you could spread the first stage metadata across multiple ZIP disks.</para> <!-- &ZIP; -->
</sect3>
<sect3>
<title>Excluding From First Stage Saving</title>
<para>There are time when you need to squeeze a few megabytes from the first stage data, expecially when you are pushing the limit of your ZIP disk. The function <command>crunch</command> in the script <link linkend="save.metadata"><filename>save.metadata</filename></link> takes multiple parameters to feed to <command>tar</command>. It can also take the <command>--exclude</command> parameter. So, for example, you can exclude <command>emacs</command> and <command>gs</command> like so:</para>
<programlisting><![ CDATA [crunch etc etc --exclude etc/samba --exclude X11]]></programlisting>
<para>There are time when you need to squeeze a few megabytes from the first stage data, especially when you are pushing the limit of your ZIP disk. The function <command>crunch</command> in the script <link linkend="save.metadata"><filename>save.metadata</filename></link> takes multiple parameters to feed to <command>tar</command>. It can also take the <command>--exclude</command> parameter. So, for example, you can exclude the <filename>samba</filename> and <filename>X11</filename> directories under <filename>/etc</filename> like so:</para>
<programlisting><![ CDATA [crunch etc etc --exclude etc/samba --exclude etc/X11]]></programlisting>
<para>Why those two? Because they're hard drive space hogs and we don't need them at boot time.</para>
<para>How to find good candidates for exclusion? List the target directories with <command>ls -alSr</command> for individual files, and <command>du | sort -n</command> for directories.</para>
<para>If you keep multiple kernels around, you can eliminate the modules for all of the kernels you won't boot to. Check your lilo.conf to see which kernel you will use, and then check <filename>/lib/modules</filename> for module directories you can exclude.</para>
<para>How to find more good candidates for exclusion? List the target directories with <command>ls -alSr</command> for individual files, and <command>du | sort -n</command> for directories.</para>
</sect3>
<sect3 id="initrd">
<title>Initrd</title>
<para>If your system uses an initial RAM disk, or initrd, to boot, make sure that <link linkend="save.metadata"><filename>save.metadata</filename></link> creates the directory <filename>/initrd</filename>. The easiest way to do this is to ensure that it is included in the list of directories used in the directory creating loop toward the end.</para>
<para>If your system uses an initial RAM disk, or initrd, to boot, make sure that <link linkend="restore.metadata"><filename>restore.metadata</filename></link> creates the directory <filename>/initrd</filename>. The easiest way to do this is to ensure that it is included in the list of directories used in the directory creating loop toward the end.</para>
<para>Your system will probably use an initrd if it boots from a SCSI drive or has root on an ext3fs partition. Check <filename>/etc/lilo.conf</filename> to see if it calls for one.</para>
</sect3>
</sect2>
@ -531,73 +474,49 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<title>First Stage Restore</title>
<sect2 id="Bootingtomsrtbt">
<title>Booting tomsrtbt</title>
<para>
The first thing to do before starting the restoration process is to verify that the hardware time is set correctly. Use the BIOS setup for this. How close to exact you have to set the time depends on your applications. For restoration, within a few minutes of exact time should be accurate enough. This will allow time-critical events to pick up where they left off when you finally launch the restored system.
</para>
<para>
Before booting <ulink url="http://www.toms.net/rb">tomsrtbt</ulink>, make sure your ZIP drive is placed on a parallel port, either /dev/lp0 or /dev/lp1. The start-up software will load the parallel port ZIP drive driver for you.
</para>
<para>The first thing to do before starting the restoration process is to verify that the hardware time is set correctly. Use the BIOS setup for this. How close to exact you have to set the time depends on your applications. For restoration, within a few minutes of exact time should be accurate enough. This will allow time-critical events to pick up where they left off when you finally launch the restored system.</para>
<para>Before booting <ulink url="http://www.toms.net/rb">tomsrtbt</ulink>, make sure your ZIP drive is placed on a parallel port, either /dev/lp0 or /dev/lp1. The start-up software will load the parallel port ZIP drive driver for you.</para>
<!-- <para> -->
<!-- I have one of those ne2000 clone Ethernet cards in my test system. This, it turns out, gives the 3c59x driver in the <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> kernel fits. The workaround is to tell the kernel to ignore its address range. At the lilo prompt, I would type: -->
<!-- </para> -->
<!-- <programlisting><![ CDATA [lilo: zImage reserve=0x300,32]]></programlisting> -->
<para>
The next step is to set the video mode. I usually like to see as much on the screen as I can. When the option to select a video mode comes, I use mode 6, 80 columns by 60 lines. Your hardware may or may not be able to handle high resolutions like that, so experiment with it.
</para>
<para>The next step is to set the video mode. I usually like to see as much on the screen as I can. When the option to select a video mode comes, I use mode 6, 80 columns by 60 lines. Your hardware may or may not be able to handle high resolutions like that, so experiment with it.</para>
</sect2>
<sect2 id="restoration">
<title>Restoration</title>
<para>
Once <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> has booted and you have a console, mount the ZIP drive. It is probably a good idea to mount it read only:
</para>
<para>Once <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> has booted and you have a console, mount the ZIP drive. It is probably a good idea to mount it read only:</para>
<programlisting># <command>mount /dev/sda1 /mnt -o ro</command></programlisting>
<para>
Check to be sure it is there:
</para>
<para>Check to be sure it is there:</para>
<programlisting># <command>ls -l /mnt</command></programlisting>
<para>At this point, you can run the restoration automatically or manually. Use the automated restore if you don't need to make any changes as you go along.</para>
<para>One consideration here is whether you have multiple hard drives. If your Linux installation mounts partitions on multiple hard drives, you must mount the root partition first. This is to ensure that mount point directories are created on the partition where they belong. The script <filename>first.stage</filename> will run the scripts to mount the drives in the order in which they are created. If you have created them (in the script <filename>save.metadata</filename>) in the order in which they cascade from root, the mounting process should work just fine.</para>
<para>If you have multiple hard drives, and they cross-mount, you are on your own. Either combine and edit the scripts to mount them in the correct order, or do it manually.</para>
<sect3>
<title>Automated</title>
<para>To run the first stage restore completely automated, enter the command:</para>
<para>The automatic process calls each of the manual scripts in proper order. It does not allow for manual intervention, say for creating file systems that this HOWTO does not support. To run the first stage restore automatically, enter the command:</para>
<programlisting># <command>/mnt/root.bin/first.stage</command></programlisting>
<para>If you want to check for back blocks, add the <command>-c</command> option.</para>
</sect3>
<sect3>
<title>Manually</title>
<para>
To run the process manually, change to the directory where the scripts are on the ZIP drive.
</para>
<para>To run the process manually, change to the directory where the scripts are on the ZIP drive.</para>
<programlisting># <command>cd /mnt/root.bin</command></programlisting>
<para>
Now run the script(s) that will restore the partition information and create file systems. You may run them in any order. e.g.:
</para>
<para>Now run the script(s) that will restore the partition information and create file systems. You may run them in any order. e.g.:</para>
<programlisting># <command>./make.dev.hda</command></programlisting>
<para>If you want to check for back blocks, add the <command>-c</command> option.</para>
<para>
This script will:
</para>
<para>This script will:</para>
<itemizedlist>
<listitem>
<para>
Clean out the first 1024 bytes of the hard drive, killing off any existing partition table and master boot record (MBR).
</para>
<para>Clean out the first 1024 bytes of the hard drive, killing off any existing partition table and master boot record (MBR).</para>
</listitem>
<listitem>
<para>
Recreate the partitions from the information gathered when you ran <link linkend="make.fdisk"><filename>make.fdisk</filename></link>.
</para>
<para>Recreate the partitions from the information gathered when you ran <link linkend="make.fdisk"><filename>make.fdisk</filename></link>.</para>
</listitem>
<listitem>
<para>
Make ext2 and ext3 file system partitions and Linux swap partitions as appropriate. If you provide the <command>-c</command> option to the script, it will also check for bad blocks.
</para>
<para>Make ext2 and ext3 file system partitions and Linux swap partitions as appropriate. If you provide the <command>-c</command> option to the script, it will also check for bad blocks.</para>
</listitem>
<listitem>
<para>
Make some types of FAT partitions.
</para>
<para>Make some types of FAT partitions.</para>
</listitem>
</itemizedlist>
<note>
@ -605,26 +524,17 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
</note>
<para>Now run the script(s) that create mount points and mount the partitions to them.</para>
<programlisting># <command>./mount.dev.hda</command></programlisting>
<para>
Once you have created all your directories and mounted partitions to them, you can run the script <link linkend="restore.metadata"><filename>restore.metadata</filename></link>. This will restore the contents of the ZIP drive to the hard drive.
</para>
<para>
You should see a directory of the ZIP disk's root directory, then a list of the archive files as they are restored. Tar on <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> will tell you that tar's block size is 20, and that's fine. You can ignore it. Be sure that lilo prints out its results:
</para>
<para>Once you have created all your directories and mounted partitions to them, you can run the script <link linkend="restore.metadata"><filename>restore.metadata</filename></link>. This will restore the contents of the ZIP drive to the hard drive.</para>
<para>You should see a directory of the ZIP disk's root directory, then a list of the archive files as they are restored. Tar on <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> will tell you that tar's block size is 20, and that's fine. You can ignore it. Be sure that lilo prints out its results:</para>
<screen><![ CDATA [Added linux *]]></screen>
<para>
That will be followed by the output from a <quote><command>df -m</command></quote> command.
</para>
That will be followed by the output from a <quote><command>df -m</command></quote> command.</para>
</sect3>
<sect3>
<title>Finishing Touches</title>
<para>
If you normally boot directly to X, you could have some problems. To be safe, change your boot run level temporarily. In <filename>/target/etc/inittab</filename>, find the line that looks like this:
</para>
<para>If you normally boot directly to X, you could have some problems. To be safe, change your boot run level temporarily. In <filename>/target/etc/inittab</filename>, find the line that looks like this:</para>
<programlisting><![ CDATA [id:5:initdefault:]]></programlisting>
<para>
and change it to this:
</para>
<para>and change it to this:</para>
<programlisting><![ CDATA [id:3:initdefault:]]></programlisting>
<para>
Now, you can gracefully reboot. Remove the <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> floppy from your floppy drive if you haven't already done so, and give the computer the three fingered salute, or its equivalent:</para>
@ -635,65 +545,38 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
</sect1>
<sect1 id="SecondStageRestoration">
<title>Second Stage Restoration</title>
<para>
As the computer reboots, go back to the BIOS and verify that the clock is more or less correct.
</para>
<para>
Once you have verified the clock is correct, exit the BIOS and reboot to the hard drive. You can simply let the computer boot in its normal sequence. You will see a lot of error messages, mostly along the lines of <quote>I can't find blah! Waahhh!</quote> If you have done your homework correctly up until now, those error messages won't matter. You don't need linuxconf or apache to do what you need to do.
</para>
<para>As the computer reboots, go back to the BIOS and verify that the clock is more or less correct.</para>
<para>Once you have verified the clock is correct, exit the BIOS and reboot to the hard drive. You can simply let the computer boot in its normal sequence. You will see a lot of error messages, mostly along the lines of <quote>I can't find blah! Waahhh!</quote> If you have done your homework correctly up until now, those error messages won't matter. You don't need linuxconf or apache to do what you need to do.</para>
<note><title>NOTE</title><para>As an alternative, you can boot to single user mode (at the lilo prompt, enter <command>linux single</command>), but you will have to configure your network manually and fire up sshd or whatever daemons you need to restore your system. How you do those things is very system specific.</para>
</note>
<para>
You should be able to log into a root console (no X -- no users, sorry). You should now be able to use the network, for example to nfs mount the backup of your system.
</para>
<para>
If you did the two stage backup I suggested for Arkeia, you can now restore Arkeia's database and executables. You should be able to run </para>
<para>You should be able to log into a root console (no X -- no users, sorry). You should now be able to use the network, for example to nfs mount the backup of your system.</para>
<para>If you did the two stage backup I suggested for Arkeia, you can now restore Arkeia's database and executables. You should be able to run</para>
<programlisting>/etc/rc.d/init.d/arkeia start</programlisting>
<para> and start the server. If you have the GUI installed on another computer with X installed, you should now be able to log in to Arkeia on your tape server, and prepare your restoration.
</para>
<note><title>NOTE</title>
<para>When you restore, read the documentation for your restoration programs carefully. For example, tar does not normally restore certain characteristics of files, like suid bits. File permissions are set by the user's umask. To restore your files exactly as you saved them, use tar's p option. Similarly, make sure your restoration software will restore everything exactly as you saved it.
</para></note
<para>
To restore the test computer:
</para>
<para>and start the server. If you have the GUI installed on another computer with X installed, you should now be able to log in to Arkeia on your tape server, and prepare your restoration.</para>
<note>
<title>NOTE</title>
<para>When you restore, read the documentation for your restoration programs carefully. For example, tar does not normally restore certain characteristics of files, like suid bits. File permissions are set by the user's umask. To restore your files exactly as you saved them, use tar's p option. Similarly, make sure your restoration software will restore everything exactly as you saved it.</para>
</note>
<para>To restore the test computer:</para>
<programlisting>bash# <command>restore.all</command></programlisting>
<para>
If you used tar for your backup and restoration, and used the -k (keep old files, don't overwrite) option, you will see a lot of this:
</para>
<para>If you used tar for your backup and restoration, and used the -k (keep old files, don't overwrite) option, you will see a lot of this:</para>
<screen><![ CDATA [tar: usr/sbin/rpcinfo: Could not create file: File exists
]]><![ CDATA [tar: usr/sbin/zdump: Could not create file: File exists
]]><![ CDATA [tar: usr/sbin/zic: Could not create file: File exists
]]><![ CDATA [tar: usr/sbin/ab: Could not create file: File exists]]></screen>
<para>
This is normal, as tar is refusing to overwrite files you restored during the first stage of restoration.
</para>
<para>
Then reboot. On the way down, you will see a lot of error messages, such as <quote>no such pid.</quote> This is a normal part of the process. The shutdown code is using the pid files from daemons that were running when the backup was made to shut down daemons that were not started on the last boot. Of course there's no such pid.
</para>
<para>
Your system should come up normally, with a lot fewer errors than it had before, ideally no errors. The acid test of how well your restore works on an RPM based system is to verify all packages:
</para>
<para>This is normal, as tar is refusing to overwrite files you restored during the first stage of restoration.</para>
<para>Then reboot. On the way down, you will see a lot of error messages, such as <quote>no such pid.</quote> This is a normal part of the process. The shutdown code is using the pid files from daemons that were running when the backup was made to shut down daemons that were not started on the last boot. Of course there's no such pid.</para>
<para>Your system should come up normally, with a lot fewer errors than it had before, ideally no errors. The acid test of how well your restore works on an RPM based system is to verify all packages:</para>
<programlisting>bash# <command>rpm -Va</command></programlisting>
<para>
Some files, such as configuration and log files, will have changed in the normal course of things, and you should be able to mentally filter those out of the report. You can redirect the output to a file, and diff it against the one that was made at backup time (/etc/rpmVa.txt), thereby speeding up this step considerably. Emacs users should check out its diff facilities.
</para>
<para>
Now you should be up and running. It is time to test your applications, especially those that run as daemons. The more sophisticated the application, the more testing you may need to do. If you have remote users, disable them from using the system, or make it <quote>read only</quote> while you test it. This is especially important for databases, to prevent making any corruption or data loss worse than it already might be.
</para>
<para>
If you normally boot to X, and disabled it above, test X before you re-enable it. Re-enable it by changing that one line in /etc/inittab back to:
</para>
<para>Some files, such as configuration and log files, will have changed in the normal course of things, and you should be able to mentally filter those out of the report. You can redirect the output to a file, and diff it against the one that was made at backup time (/etc/rpmVa.txt), thereby speeding up this step considerably. Emacs users should check out its diff facilities.</para>
<para>Now you should be up and running. It is time to test your applications, especially those that run as daemons. The more sophisticated the application, the more testing you may need to do. If you have remote users, disable them from using the system, or make it <quote>read only</quote> while you test it. This is especially important for databases, to prevent making any corruption or data loss worse than it already might be.</para>
<para>If you normally boot to X, and disabled it above, test X before you re-enable it. Re-enable it by changing that one line in /etc/inittab back to:</para>
<programlisting><![ CDATA [id:5:initdefault:]]></programlisting>
<para>
You should now be ready for rock and roll -- and some aspirin and a couch.
</para>
<para>You should now be ready for rock and roll -- and some aspirin and a couch.</para>
</sect1>
<sect1 id="DistributionSpecificNotes">
<title>Distribution Specific Notes</title>
<para>
Below are distribution notes from past experiences. If you have additional notes that you would like to add for other distributions, please forward them to me.
</para>
<para>Below are distribution notes from past experiences. If you have additional notes that you would like to add for other distributions, please forward them to me.</para>
<sect2 id="RedHat80">
<title>Red Hat 8.0</title>
<para>Red Hat 8.0 requires changes only if you log in via ssh to your computer after the first stage restore. If, say, you perform the second state restore over ssh. If so, make the following changes:</para>
@ -703,34 +586,32 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<programlisting>crunch kerberos usr/kerberos/lib/</programlisting>
</listitem>
<listitem>
<para>In the file <filename>restore.metadata</filename>, there is a loop that builds several directories. First, add these two directory names to the list: <filename>/var/empty/sshd</filename> and <filename>/var/lock/subsys</filename>. As Red Hat 8.0 defaults to ext3fs, it requires an inital RAM disk at boot time. So make sure <filename>initrd</filename> is in the list. Then, if it isn't already there, add the <command>-p</command> switch to the makdir command.</para>
<para>In the file <filename>restore.metadata</filename>, there is a loop that builds several directories. First, add these two directory names to the list: <filename>/var/empty/sshd</filename> and <filename>/var/lock/subsys</filename>. As Red Hat 8.0 defaults to ext3fs, it requires an initial RAM disk at boot time. So make sure <filename>initrd</filename> is in the list. Then, if it isn't already there, add the <command>-p</command> switch to the mkdir command.</para>
<para>The directory <filename>/var/lock/subsys</filename> is owned by group lock, so change its owner.</para>
<programlisting>chroot $target /bin/chown root:lock /var/lock</programlisting>
<para>Finally, <filename>usr/lib/libcrypto*</filename> has gone away, so you can remove that from the line that crunches <filename>usr/lib</filename>. </para>
<para>Finally, <filename>usr/lib/libcrypto*</filename> has gone away, so you can remove that from the line that crunches <filename>usr/lib</filename>.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2 id="RedHat71">
<title>Red Hat 7.1</title>
<para>
This distribution is the one I used originally on my test computer. I have had no problems with it.
</para>
<para>This distribution is the one I used originally on my test computer. I have had no problems with it.</para>
</sect2>
<sect2 id="RedHat70">
<title>Red Hat 7.0</title>
<para>
This version seems to require libcrack (in /usr/lib) and its attendant files in order to authenticate users. So in <link linkend="save.metadata"><filename>save.metadata</filename></link>, add to the line that saves /usr/lib the following: /usr/lib/*crack* and enable that line.
</para>
<para>This version seems to require libcrack (in /usr/lib) and its attendant files in order to authenticate users. So in <link linkend="save.metadata"><filename>save.metadata</filename></link>, add to the line that saves /usr/lib the following: /usr/lib/*crack* and enable that line.</para>
</sect2>
</sect1>
<sect1 id="ApplicationSpecificNotes">
<title>Application Specific Notes</title>
<para>
I have listed below notes about backing up particular applications.
</para>
<para>Here are some notes about backing up particular applications.</para>
<sect2 id="tripwire">
<title>Tripwire</title>
<para>If you run Tripwire or any other application that maintains a database of file metadata, rebuild that database immediately after restoring.</para>
</sect2>
<sect2 id="Squid">
<title>Squid</title>
<para>Squid is a http proxy and cache. As such it keeps a lot of temporary data on the hard drive. There is no point in backing that up. Insert <quote>--exclude /var/spool/squid</quote> into the appropriate tar command in your second stage backup script. Then, get squid to rebuild its directory structure for you. Tack onto the tail end of the second stage restore script a command for squid to initialize itself. Here is how I did it over ssh in <link linkend="restore.tester"><filename>restore.tester</filename></link>:</para>
<para>Squid is a HTTP proxy and cache. As such it keeps a lot of temporary data on the hard drive. There is no point in backing that up. Insert <quote>--exclude /var/spool/squid</quote> into the appropriate tar command in your second stage backup script. Then, get squid to rebuild its directory structure for you. Tack onto the tail end of the second stage restore script a command for squid to initialize itself. Here is how I did it over ssh in <link linkend="restore.tester"><filename>restore.tester</filename></link>:</para>
<programlisting><![ CDATA [ssh $target "mkdir /var/spool/squid ; chown squid:squid /var/spool/squid;\
/usr/sbin/squid -z;touch /var/spool/squid/.OPB_NOBACKUP"]]></programlisting>
<para>The last command creates a file of length 0 called .OPB_NOBACKUP. This is for the benefit of <link linkend="arkeia">Arkeia</link>, and tells Arkeia not to back up below this directory</para>
@ -739,12 +620,12 @@ pubwork="journal">Linux Journal</citetitle></ulink>. My thanks to
<title>Arkeia</title>
<para>These notes are based on testing with Arkeia 4.2.</para>
<para><ulink url="http://www.arkeia.com/">Arkeia</ulink> is a backup and restore program that runs on a wide variety of platforms. You can use Arkeia as part of a bare metal restoration scheme, but there are two caveats.</para>
<para>The first is probably the most problematic, as absent any more elegant solution you have to hand select the directories to restore in the navigator at restoration time. The reason is that, apparently, Arkeia has no mechanism for not restoring files already present on the disk, nothing anlogous to <command>tar</command>'s -p option. If you simply allow a full restore, the restore will crash as Arkeia over-writes a library which is in use at restore time, e.g. lib/libc-2.1.1.so. Hand selection of directories to restore is at best dicy, so I recommend against it.</para>
<para>The first is probably the most problematic, as absent any more elegant solution you have to hand select the directories to restore in the navigator at restoration time. The reason is that, apparently, Arkeia has no mechanism for not restoring files already present on the disk, nothing analogous to <command>tar</command>'s -p option. If you simply allow a full restore, the restore will crash as Arkeia over-writes a library which is in use at restore time, e.g. <filename>lib/libc-2.1.1.so</filename>. Hand selection of directories to restore is at best dicey, so I recommend against it.</para>
<para>The second caveat is that you have to back up the Arkeia data dictionary and/or programs. To do that, modify the <filename>save.metatdata</filename> script by adding Arkeia to the list of directories to save:</para>
<programlisting><![ CDATA [# arkeia specific:
tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<para>You <emphasis>must</emphasis> back up the data dictionary this way because Arkeia does not back up the data dictionary. This is one of my complaints about Arkeia, and I solve it on my own computer by saving the data dictionary to tape with <ulink url="http://www.estinc.com/">The TOLIS Group's BRU</ulink>.</para>
<para>You <emphasis>must</emphasis> back up the data dictionary this way because Arkeia does not back up the data dictionary. This is one of my complaints about Arkeia, and I solve it on my own computer by saving the data dictionary to tape with <ulink url="http://www.estinc.com/">The TOLIS Group's BRU</ulink>.</para> <!-- bad host name: 2003 07 25 -->
<para>The data dictionary will be restored in the script <filename>restore.metadata</filename> automatically.</para>
</sect2>
<sect2 id="amanda">
@ -756,56 +637,39 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
</programlisting>
<para>where <command>$file</command> is the script's argument, the image recovered from the tape by <command>amrestore</command>.</para>
<para>Since the command line arguments to <command>tar</command> prohibit over-writing, restore from images in the <emphasis>reverse</emphasis> of the order in which they were made. Restore most recent first.</para>
<para>Amanda does require setting ownership by hand if you back up the amanda data directory with <link linkend="save.metadata"><filename>save.metadata</filename></link>. Something like:</para>
<programlisting>bash# <command>chown -R amanda:disk /var/lib/amanda</command></programlisting>
<para>You can also add that line to your scripts for second state restoration, such as <link linkend="restore.tester"><filename>restore.tester</filename></link>.</para>
</sect2>
</sect1>
<sect1 id="SomeAdviceforDisasterRecovery">
<title>Some Advice for Disaster Recovery</title>
<para>
You should take your ZIP disk for each computer and the printouts you made, and place them in a secure location in your shop. You should store copies of these in your off-site backup storage location. The major purpose of off-site backup storage is to enable disaster recovery, and restoring each host onto replacement hardware is a part of disaster recovery.
</para>
<para>
You should also have several <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> floppies and possibly some ZIP drives in your off-site storage as well. Also, have copies of the <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> distribution on several of your computers so that they back each other up.
</para>
<para>
You should probably have copies of this HOWTO, with your site-specific annotations on it, with your backups and in your off-site backup storage.
</para>
<para>You should take your ZIP disk for each computer and the printouts you made, and place them in a secure location in your shop. You should store copies of these in your off-site backup storage location. The major purpose of off-site backup storage is to enable disaster recovery, and restoring each host onto replacement hardware is a part of disaster recovery.</para>
<para>You should also have several <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> floppies and possibly some ZIP drives in your off-site storage as well. Also, have copies of the <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> distribution on several of your computers so that they back each other up.</para>
<para>You should probably have copies of this HOWTO, with your site-specific annotations on it, with your backups and in your off-site backup storage.</para>
</sect1>
<sect1 id="WhatNow">
<title>What Now?</title>
<para>
This HOWTO results from experiments on one computer. No doubt you will find some directories or files you need to back up in your first stage backup. I have not dealt with saving and restoring X on the first stage, nor have I touched at all on processors other than Intel.
</para>
<para>
I would appreciate your feedback as you test and improve these scripts on your own computers. I also encourage vendors of backup software to document how to do a minimal backup of their products. I'd like to see the whole Linux community sleep just a little better at night.
</para>
<para>This HOWTO results from experiments on one computer. No doubt you will find some directories or files you need to back up in your first stage backup. I have not dealt with saving and restoring X on the first stage, nor have I touched at all on processors other than Intel.</para>
<para>I would appreciate your feedback as you test and improve these scripts on your own computers. I also encourage vendors of backup software to document how to do a minimal backup of their products. I'd like to see the whole Linux community sleep just a little better at night.</para>
<sect2 id="todo">
<title>To Do</title>
<para>
Volunteers are most welcome. Check with me before you start on one of these in case someone else is working on it already.
</para>
<para>Volunteers are most welcome. Check with me before you start on one of these in case someone else is working on it already.</para>
<itemizedlist>
<listitem>
<para>
A partition editor to adjust partition boundaries for a different hard drive, or the same one with different geometry, or to adjust partition sizes within the same hard drive. A GUI would probably be a good idea here. On the other tentacle, the FSF's <ulink url="http://www.gnu.org/software/parted"><filename>parted</filename></ulink> looks like it will fill part of the bill. It does re-size existing partitions, but with restrictions.
</para>
<para>A partition editor to adjust partition boundaries for a different hard drive, or the same one with different geometry, or to adjust partition sizes within the same hard drive. A GUI would probably be a good idea here. On the other tentacle, the FSF's <ulink url="http://www.gnu.org/software/parted"><filename>parted</filename></ulink> looks like it will fill part of the bill. It does re-size existing partitions, but with restrictions.</para>
</listitem>
<listitem>
<para>
<link linkend="make.fdisk"><filename>make.fdisk</filename></link> currently only recognizes some FAT partitions, not all. Add code to <link linkend="make.fdisk"><filename>make.fdisk</filename></link> to recognize others and make appropriate instructions to rebuild them in the output files.
</para>
<para><link linkend="make.fdisk"><filename>make.fdisk</filename></link> currently only recognizes some FAT partitions, not all. Add code to <link linkend="make.fdisk"><filename>make.fdisk</filename></link> to recognize others and make appropriate instructions to rebuild them in the output files.</para>
</listitem>
<listitem>
<para>For FAT12 or FAT16 partitions we do not format, write zeros into the partition so that Mess-DOS 6.x does not get confused. See the notes on <command>fdisk</command> for an explanation of the problem.</para>
</listitem>
<listitem>
<para>
Make a script for putting ext2/3 file systems on ZIP disks.
</para>
<para>Make a script for putting ext2/3 file systems on ZIP disks.</para>
</listitem>
<listitem>
<para>
Translations into other (human) languages.
</para>
<para>Translations into other (human) languages.</para>
</listitem>
<listitem>
<para>Find out how loadlin or similar programs affect this process.</para>
@ -813,9 +677,6 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<listitem>
<para>Changes for GRUB</para>
</listitem>
<listitem>
<para>Change the scripts to use a CD-ROM. A CD-ROM that would boot to <ulink url="http://www.toms.net/rb">tomsrtbt</ulink>, with the first stage restore data on the rest of it, would be just the ticket.</para>
</listitem>
<listitem>
<para>I've referred to Red Hat Package Manager (rpm) from time to time. What are the equivalent deb commands?</para>
</listitem>
@ -824,16 +685,12 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
</sect1>
<sect1 id="TheScripts">
<title>The Scripts</title>
<para>
See the notes in the beginning of each script for a summary of what it does.
</para>
<para>See the notes in the beginning of each script for a summary of what it does.</para>
<sect2 id="FirstStage">
<title>First Stage</title>
<sect3 id="make.fdisk">
<title><filename>make.fdisk</filename></title>
<para>
This script, run at backup time, creates scripts similar to <link linkend="make.dev.hda"><filename>make.dev.hda</filename></link> and <link linkend="mount.dev.hda"><filename>mount.dev.x</filename></link>, below, for you to run at restore time. It also produces data files similar to <link linkend="dev.hda"><filename>dev.hda</filename></link>, below. The name of the script and data file produced depends on the device given this script as a a parameter. That script, run at restore time, builds the partitions on the hard drive. <filename>make.fdisk</filename> is called from <link linkend="save.metadata"><filename>save.metadata</filename></link>, below.
</para>
<para>This script, run at backup time, creates scripts similar to <link linkend="make.dev.hda"><filename>make.dev.hda</filename></link> and <link linkend="mount.dev.hda"><filename>mount.dev.x</filename></link>, below, for you to run at restore time. It also produces data files similar to <link linkend="dev.hda"><filename>dev.hda</filename></link>, below. The name of the script and data file produced depends on the device given this script as a a parameter. That script, run at restore time, builds the partitions on the hard drive. <filename>make.fdisk</filename> is called from <link linkend="save.metadata"><filename>save.metadata</filename></link>, below.</para>
<!-- #include program listings to make updates easier. C^2 -->
<programlisting>&make.fdisk;</programlisting>
</sect3>
@ -857,16 +714,12 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
</sect3>
<sect3 id="save.metadata">
<title><filename>save.metadata</filename></title>
<para>
This is the first script to run as part of the backup process. It calls <link linkend="make.fdisk"><filename>make.fdisk</filename></link>, above. If you have a SCSI hard drive or multiple hard drives to back up, edit the call to <link linkend="make.fdisk"><filename>make.fdisk</filename></link> appropriately.
</para>
<para>This is the first script to run as part of the backup process. It calls <link linkend="make.fdisk"><filename>make.fdisk</filename></link>, above. If you have a SCSI hard drive or multiple hard drives to back up, edit the call to <link linkend="make.fdisk"><filename>make.fdisk</filename></link> appropriately.</para>
<programlisting>&save.metadata;</programlisting>
</sect3>
<sect3 id="restore.metadata">
<title><filename>restore.metadata</filename></title>
<para>
This script restores metadata from the ZIP disk as a first stage restore.
</para>
<para>This script restores metadata from the ZIP disk as a first stage restore.</para>
<programlisting>&restore.metadata;</programlisting>
</sect3>
<sect3 id="first.stage">
@ -878,35 +731,25 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
</sect2>
<sect2 id="SecondStage">
<title>Second Stage</title>
<para>
These scripts run on the computer being backed up or restored.
</para>
<para>These scripts run on the computer being backed up or restored.</para>
<sect3 id="back.up.all">
<title><filename>back.up.all</filename></title>
<para>
This script saves to another computer via an NFS mount. You can adapt it to save to tape drives or other media.
</para>
<para>This script saves to another computer via an NFS mount. You can adapt it to save to tape drives or other media.</para>
<programlisting>&back.up.all;</programlisting>
</sect3>
<sect3 id="back.up.all.ssh">
<title><filename>back.up.all.ssh</filename></title>
<para>
This script does exactly what <link linkend="back.up.all"><filename>back.up.all</filename></link> does, but it uses ssh instead of nfs.
</para>
<para>This script does exactly what <link linkend="back.up.all"><filename>back.up.all</filename></link> does, but it uses ssh instead of nfs.</para>
<programlisting>&back.up.all.ssh;</programlisting>
</sect3>
<sect3 id="restore.all">
<title><filename>restore.all</filename></title>
<para>
This is the restore script to use if you backed up using <link linkend="back.up.all"><filename>back.up.all</filename></link>.
</para>
<para>This is the restore script to use if you backed up using <link linkend="back.up.all"><filename>back.up.all</filename></link>.</para>
<programlisting>&restore.all;</programlisting>
</sect3>
<sect3 id="restore.all.ssh">
<title><filename>restore.all.ssh</filename></title>
<para>
This is the restoration script to use if you used <link linkend="back.up.all.ssh"><filename>back.up.all.ssh</filename></link> to back up.
</para>
<para>This is the restoration script to use if you used <link linkend="back.up.all.ssh"><filename>back.up.all.ssh</filename></link> to back up.</para>
<programlisting>&restore.all.ssh;</programlisting>
</sect3>
</sect2>
@ -939,7 +782,7 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<para><ulink url="http://www.toms.net/rb">tomsrtbt</ulink>, <quote>The most Linux on 1 floppy disk.</quote> Tom also has links to other small disties.</para>
</listitem>
<listitem>
<para>The <ulink url="http://www.tldp.org/">Linux Documentation Project</ulink>. See particularly the <quote><citetitle pubwork="article">LILO, Linux Crash Rescue HOW-TO</citetitle></quote></para>
<para>The <ulink url="http://www.tldp.org/">Linux Documentation Project</ulink>. See particularly the <quote><citetitle pubwork="article">LILO, Linux Crash Rescue HOW-TO</citetitle>.</quote></para>
</listitem>
<listitem>
<para>The Free Software Foundation's <ulink url="http://www.gnu.org/software/parted"><filename>parted</filename></ulink> for editing (enlarging, shrinking, moving) partitions.</para>
@ -958,10 +801,10 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<para>The <ulink url="http://crashrecovery.org/">Crash Recovery Kit for Linux</ulink></para>
</listitem>
<listitem>
<para>The <ulink url="http://beeblebrox.sourceforge.net/">Beeblebrox Project</ulink> looks promising.</para>
<para><quote><ulink url="http://www.feyrer.de/g4u/">g4u (&apos;ghost for unix&apos;)</ulink> is a NetBSD-based bootfloppy/CD-ROM that allows easy cloning of PC harddisks to deploy a common setup on a number of PCs using FTP. The floppy/CD offers two functions. First is to upload the compressed image of a local harddisk to a FTP server. Other is to restore that image via FTP, uncompress it and write it back to disk; network configuration is fetched via DHCP. As the harddisk is processed as a image, any filesystem and operating system can be deployed using g4u.</quote></para>
</listitem>
<listitem>
<para><quote><ulink url="http://www.feyrer.de/g4u/">g4u (&apos;ghost for unix&apos;)</ulink> is a NetBSD-based bootfloppy/CD-ROM that allows easy cloning of PC harddisks to deploy a common setup on a number of PCs using FTP. The floppy/CD offers two functions. First is to upload the compressed image of a local harddisk to a FTP server. Other is to restore that image via FTP, uncompress it and write it back to disk; network configuration is fetched via DHCP. As the harddisk is processed as a image, any filesystem and operating system can be deployed using g4u.</quote></para>
<para><ulink url="http://www-106.ibm.com/developerworks/linux/library/l-knopx.html?ca=dgr-lnxw04Knoppix"><quote>System recovery with Knoppix</quote></ulink> is a good introduction to system recovery in general, and has some useful <ulink url="http://www.knoppix.org/">Knoppix</ulink> links.</para>
</listitem>
</itemizedlist>
</sect1>