Added LVM and finnix material, also some notes on ntfs.

This commit is contained in:
ccurley 2006-04-06 15:49:07 +00:00
parent 0881a4eb0a
commit 23fc6c4278
1 changed files with 51 additions and 12 deletions

View File

@ -3,7 +3,9 @@
<!-- These allow the equivalent of #includes below. C^2 -->
<!ENTITY make.fdisk SYSTEM "cooked/make.fdisk">
<!ENTITY make.dev.hda SYSTEM "cooked/make.dev.hda">
<!ENTITY make.lvs SYSTEM "cooked/make.lvs">
<!ENTITY mount.dev.hda SYSTEM "cooked/mount.dev.hda">
<!ENTITY mount.lvs SYSTEM "cooked/mount.lvs">
<!ENTITY dev.hda SYSTEM "cooked/dev.hda">
<!ENTITY save.metadata SYSTEM "cooked/save.metadata">
<!ENTITY restore.metadata SYSTEM "cooked/restore.metadata">
@ -68,6 +70,12 @@ Change notes:
<!-- Additional revision history entries go here -->
<!-- Can we automate this? C^2 -->
<revision>
<revnumber>2.1</revnumber>
<date>2006-03-28</date>
<authorinitials>c^2</authorinitials>
<revremark>Added notes for NTFS. Edited the To Do list. Started work on LVM and using <ulink url="http://www.finnix.org/">finnix</ulink>.</revremark>
</revision>
<revision>
<revnumber>2.0</revnumber>
<date>2005-10-12</date>
<authorinitials>c^2</authorinitials>
@ -362,7 +370,7 @@ Change notes:
<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 now use <ulink url="http://www.knoppix.org/">Knoppix</ulink>. See the notes on <link linkend="knoppix">Knoppix</link> below.</para>
<para>Build yourself a rescue disk. I now use <ulink url="http://www.knoppix.org/">Knoppix</ulink>. See the notes on <link linkend="knoppix">Knoppix</link> below. However, Knoppix has a problem: no LVM support. If you want to recover logical volumes, get a distribution that supports them. For this I use <ulink url="http://www.finnix.org/">finnix</ulink>.</para>
<para>In the past, I have used <ulink url="http://www.toms.net/rb">tomsrtbt</ulink>. It is well documented and packs a lot of useful tools onto one floppy diskette. Unfortunately, the changes I've had to make in the scripts to handle more recent Linux systems cause problems for <ulink url="http://www.toms.net/rb">tomsrtbt</ulink>. The <ulink url="http://www.toms.net/rb">tomsrtbt</ulink> 2.0.103 tar is based on <ulink url="http://www.busybox.net/">busybox</ulink>, so remarks about it may apply to other Linux disties which use busybox.</para>
<para>We will call whatever Linux you use the <quote>restoration Linux</quote>.</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>
@ -442,8 +450,8 @@ Change notes:
</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. This does not work with a CD-ROM based Linux like <ulink url="http://www.knoppix.org/">Knoppix</ulink> because the Linux has to have the CD-ROM drive. Unless you have two CD-ROM drives, say one in a USB clamshell. I have a DVD burner set up this way with exactly this in mind.</para>
<para>Or look at <ulink url="http://www.knoppix.net/wiki/Knoppix_Remastering_Howto">remastering</ulink> Knoppix with your first and second stage backups on the CD-ROM/DVD.</para>
<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. This does not work with some CD-ROM based Linuxes, like <ulink url="http://www.knoppix.org/">Knoppix</ulink>, because the Linux has to have the CD-ROM drive. Unless you have two CD-ROM drives, say one in a USB clamshell. I have a DVD burner set up this way with exactly this in mind.</para>
<para>Or look at <ulink url="http://www.knoppix.net/wiki/Knoppix_Remastering_Howto">remastering</ulink> Knoppix with your first and second stage backups on the CD-ROM/DVD. You should also be able to <ulink url="http://www.finnix.org/Remastering_Finnix">remaster finnix</ulink>.</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>
@ -494,6 +502,10 @@ Change notes:
<para>Before booting <ulink url="http://www.knoppix.org/">Knoppix</ulink>, make sure your ZIP drive (or substitute) is installed on a parallel port, either <filename>/dev/lp0</filename> or <filename>/dev/lp1</filename>. Knoppix does not load the parallel port ZIP drive driver for you. Instead, use the command <command>modprobe ppa</command> (as root) to install it.</para>
<para>Boot <ulink url="http://www.knoppix.org/">Knoppix</ulink> as usual. I find it faster and more useful to boot to a console. At the boot menu, use the command <quote>knoppix 2</quote>. Then become the root user, with <command>su -</command>. For the password, just hit return.</para>
</sect3>
<sect3 id="bootingfinnix">
<title>Finnix</title>
<para>One option for booing <ulink url="http://www.finnix.org/">finnix</ulink> is the &quot;toram&quot; option, which lets you move the whole kazoo into RAM. that in turn should let you load another CD, with your first stage data, into the CD drive.</para>
</sect3>
</sect2>
<sect2 id="restoration">
<title>Restoration</title>
@ -502,7 +514,7 @@ Change notes:
<programlisting># <command>mount /dev/sda1 /mnt -o ro</command></programlisting>
<para>Check to be sure it is there:</para>
<programlisting># <command>ls -l /mnt</command></programlisting>
<para>On <ulink url="http://www.knoppix.org/">Knoppix</ulink>, you may want to make a directory under <filename>/mnt</filename> and mount it there, like so:</para>
<para>On <ulink url="http://www.knoppix.org/">Knoppix</ulink> or <ulink url="http://www.finnix.org/">finnix</ulink>, you may want to make a directory under <filename>/mnt</filename> and mount it there, like so:</para>
<programlisting># <command>mkdir /mnt/zip</command>
# <command>mount /dev/sda1 /mnt/zip -o ro</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>
@ -542,7 +554,9 @@ Change notes:
</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>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>.</para>
<programlisting># <command>./restore.metadata</command></programlisting>
<para>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>
@ -618,10 +632,19 @@ diff /etc/rpmVa.txt ~/foo.txt</command></programlisting>
<para>Also see <ulink url="http://www-106.ibm.com/developerworks/linux/library/l-knopx.html?ca=dgr-lnxw04Knoppix"><quote>System recovery with Knoppix</quote></ulink>.</para>
<para>Do your restore as user <quote>root</quote> rather than as user <quote>knoppix</quote>. Otherwise you may get some directories and files owned by an oddball user or group. Also, for <ulink url="http://www.knoppix.org/">Knoppix</ulink>, we tar the first stage stuff saving numeric user &amp; group values instead of by name. The names may point to different numbers on knoppix, so we would be restoring the files incorrectly.</para>
</sect2>
<sect2>
<title>finnix</title>
<para><Ulink Url="Http://Www.Finnix.Org/">Finnix</Ulink> has some of the same advantages of Knoppix. In addition, it runs in command line mode with mouse support, which is great for the task at hand. It's small, under 100 MB as of this writing, so you can remaster it with your first stage data on it. It boots quickly. And it has LVM support. And Zile, a subset of Emacs. I am pleased with <ulink url="http://www.finnix.org/">finnix</ulink> for this use.</para>
</sect2>
</sect1>
<sect1 id="ApplicationSpecificNotes">
<title>Application Specific Notes</title>
<para>Here are some notes about backing up particular applications.</para>
<sect2 id="lvm">
<title>Logical Volume Manager</title>
<para>Handling logical volumes turns out to be a bit of a trick: use the <ulink url="http://www.finnix.org/">finnix</ulink> distribution's startup code to turn LVM on and off. This results in distribution specific code for the first stage of restoration. It is generated in <link linkend="make.fdisk"><filename>make.fdisk</filename></link>. To edit it, search <link linkend="make.fdisk"><filename>make.fdisk</filename></link> on <quote>Hideous</quote>.</para>
<para>LVM required the addition of two new LVM specific scripts, <link linkend="make.lvs">make.lvs</link> and <link linkend="mount.lvs">mount.lvs</link>. They are only generated and used if there are logical volumes present.</para>
</sect2>
<sect2 id="selinux">
<title>Selinux</title>
<para>Selinux is disabled on the test machines. <filename>/selinux</filename> is not backed up in any of these scripts. At a guess, you should probably disable selinux after the first stage restoration, and you will probably have some selinux specific tasks to perform before turning it back on.</para>
@ -687,6 +710,11 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<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>
<sect2 id="ntfs">
<title>NTFS</title>
<para>OK, NTFS isn't an application. It is a file system used by Microsoft operating system Windows NT and its descendents, including Windows 2000 and Windows XP. You can back it up and restore to it from Linux with <command>ntfsclone</command>, one of the NTFS utilities in the ntfsprogs suite, available from <ulink url="http://linux-ntfs.sourceforge.net/downloads.html">http://linux-ntfs.sourceforge.net/downloads.html</ulink>.</para>
<para>These scripts will create NTFS partitions, but will not put a file system on them. It is not clear from the docs whether <command>ntfsclone</command> will lay down a file system on a virgin partition or not.</para>
</sect2>
</sect1>
<sect1 id="SomeAdviceforDisasterRecovery">
<title>Some Advice for Disaster Recovery</title>
@ -702,6 +730,10 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<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>
<itemizedlist>
<listitem>
<para>We have no way to determine the label of a swap partition. This means that there is no way to provide the swap partition's label when restoring. We could assume that a system with a single swap partition (as indicated by fdisk) has the label used in the swap partition line in <filename>/etc/fstab</filename>, but that only works on single hard drive systems, and could produce subtle errors in systems with multiple swap partitions.</para>
<para>The work-around is to add the label by hand by re-running <filename>mkswap</filename> with the -L option on it. Sigh.</para>
</listitem>
<listitem>
<para>A partition editor to adjust partition boundaries in the <filename>dev.hdx</filename> file. This will let users adjust partitions 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>
@ -711,18 +743,12 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<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>
</listitem>
<listitem>
<para>Translations into other (human) languages.</para>
</listitem>
<listitem>
<para>Find out how loadlin or similar programs affect this process.</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>
</listitem>
<listitem>
<para>Modify the first stage backup code to only save the current kernel.</para>
</listitem>
@ -747,12 +773,22 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<para>If you want make.dev.hda to check for bad blocks when it puts a file system on the partitions, use a &quot;-c&quot; command line option.</para>
<programlisting>&make.dev.hda;</programlisting>
</sect3>
<sect3 id="make.lvs">
<title><filename>make.lvs</filename></title>
<para><filename>make.lvs</filename> is generated by <link linkend="make.fdisk"><filename>make.fdisk</filename></link>, but only if logical volumes are present. As the name suggests, it builds the logical volumes and makes file systems on them.</para>
<programlisting>&make.lvs;</programlisting>
</sect3>
<sect3 id="mount.dev.hda">
<title><filename>mount.dev.hda</filename></title>
<para>This script is a sample of the sort produced by <link linkend="make.fdisk"><filename>make.fdisk</filename></link>, above. It builds mount points and mounts partitions on them, making the target file system ready for restoring files. This is the second script run at restore time.</para>
<para>If you are brave enough to edit <link linkend="dev.hda"><filename>dev.hda</filename></link> (q.v.), say, to add a new partition, you may need to edit this script as well.</para>
<programlisting>&mount.dev.hda;</programlisting>
</sect3>
<sect3 id="mount.lvs">
<title><filename>mount.lvs</filename></title>
<para><filename>mount.lvs</filename> is generated by <link linkend="make.fdisk"><filename>make.fdisk</filename></link>, but only if logical volumes are present. As the name suggests, it mounts the logical volumes ready for restoration.</para>
<programlisting>&mount.lvs;</programlisting>
</sect3>
<sect3 id="dev.hda">
<title><filename>dev.hda</filename></title>
<para>This data file is used at restore time. It is fed to <command>fdisk</command> by the script <link linkend="make.dev.hda"><filename>make.dev.hda</filename></link>. It is produced at backup time by <link linkend="make.fdisk"><filename>make.fdisk</filename></link>. Those familiar with <command>fdisk</command> will recognize that each line is an <command>fdisk</command> command or value, such as a cylinder number. Thus, it is possible to change the partition sizes and add new partitions by editing this file. That's why the penultimate command is <command>v</command>, to verify the partition table before it is written.</para>
@ -818,6 +854,9 @@ tar cf - usr/knox | gzip -c > $zip/arkeia.tar.gz]]></programlisting>
<title>Resources</title>
<para>In no particular order. These are things you might want to investigate for yourself. A listing here should not be taken as an endorsement. In fact, in many case I have not used the product and cannot comment on it.</para>
<itemizedlist>
<listitem>
<para><ulink url="http://osdev.berlios.de/netboot.html">Network-booting Your Operating System</ulink> describes several techniques for booting across a network, using <ulink url="http://www.gnu.org/software/grub/">grub</ulink> and some other tricks. I haven't tried it, but I have a sneaky suspicion that with an especially trained floppy diskette, you could get your entire first stage image onto the computer to be restored.</para>
</listitem>
<listitem>
<para><quote><ulink url="http://btmgr.webframe.org/">Smart Boot Manager (SBM)</ulink> is an OS independent and full-featured boot manager with an easy-to-use user interface. There are some screen shots available.</quote> It is essential if your BIOS will not allow you to boot to CD-ROM and you want to use a CD-ROM based Linux for Stage 1 recovery.</para>
</listitem>