⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 backup-basics.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<div class="SECT3"><h3 class="SECT3"><a id="AEN25028" name="AEN25028">16.11.8.1 Before the Disaster</a></h3><p>There are only four steps that you need to perform in preparation for any disasterthat may occur.</p><p>First, print the disklabel from each of your disks (e.g. <tt class="COMMAND">disklabelda0 | lpr</tt>), your file system table (<tt class="FILENAME">/etc/fstab</tt>) and allboot messages, two copies of each.</p><p>Second, determine that the boot and fix-it floppies (<ttclass="FILENAME">boot.flp</tt> and <tt class="FILENAME">fixit.flp</tt>) have all yourdevices. The easiest way to check is to reboot your machine with the boot floppy in thefloppy drive and check the boot messages. If all your devices are listed and functional,skip on to step three.</p><p>Otherwise, you have to create two custom bootable floppies which have a kernel thatcan mount all of your disks and access your tape drive. These floppies must contain: <ttclass="COMMAND">fdisk</tt>, <tt class="COMMAND">disklabel</tt>, <ttclass="COMMAND">newfs</tt>, <tt class="COMMAND">mount</tt>, and whichever backup programyou use. These programs must be statically linked. If you use <ttclass="COMMAND">dump</tt>, the floppy must contain <tt class="COMMAND">restore</tt>.</p><p>Third, create backup tapes regularly. Any changes that you make after your last backupmay be irretrievably lost. Write-protect the backup tapes.</p><p>Fourth, test the floppies (either <tt class="FILENAME">boot.flp</tt> and <ttclass="FILENAME">fixit.flp</tt> or the two custom bootable floppies you made in steptwo.) and backup tapes. Make notes of the procedure. Store these notes with the bootablefloppy, the printouts and the backup tapes. You will be so distraught when restoring thatthe notes may prevent you from destroying your backup tapes (How? In place of <ttclass="COMMAND">tar xvf /dev/sa0</tt>, you might accidentally type <ttclass="COMMAND">tar cvf /dev/sa0</tt> and over-write your backup tape).</p><p>For an added measure of security, make bootable floppies and two backup tapes eachtime. Store one of each at a remote location. A remote location is NOT the basement ofthe same office building. A number of firms in the World Trade Center learned this lessonthe hard way. A remote location should be physically separated from your computers anddisk drives by a significant distance.</p><div class="EXAMPLE"><a id="AEN25056" name="AEN25056"></a><p><b>Example 16-3. A Script for Creating a Bootable Floppy</b></p><pre class="PROGRAMLISTING">#!/bin/sh## create a restore floppy## format the floppy#PATH=/bin:/sbin:/usr/sbin:/usr/binfdformat -q fd0if [ $? -ne 0 ]then     echo "Bad floppy, please use a new one"     exit 1fi# place boot blocks on the floppy#disklabel -w -B /dev/fd0c fd1440## newfs the one and only partition#newfs -t 2 -u 18 -l 1 -c 40 -i 5120 -m 5 -o space /dev/fd0a## mount the new floppy#mount /dev/fd0a /mnt## create required directories#mkdir /mnt/devmkdir /mnt/binmkdir /mnt/sbinmkdir /mnt/etcmkdir /mnt/rootmkdir /mnt/mnt          # for the root partitionmkdir /mnt/tmpmkdir /mnt/var## populate the directories#if [ ! -x /sys/compile/MINI/kernel ]then     cat &#60;&#60; EOMThe MINI kernel does not exist, please create one.Here is an example config file:## MINI -- A kernel to get FreeBSD onto a disk.#machine         "i386"cpu             "I486_CPU"ident           MINImaxusers        5options         INET                    # needed for _tcp _icmpstat _ipstat                                        #            _udpstat _tcpstat _udboptions         FFS                     #Berkeley Fast File Systemoptions         FAT_CURSOR              #block cursor in syscons or pcconsoptions         SCSI_DELAY=15           #Be pessimistic about Joe SCSI deviceoptions         NCONS=2                 #1 virtual consolesoptions         USERCONFIG              #Allow user configuration with -c XXXconfig          kernel  root on da0 swap on da0 and da1 dumps on da0device          isa0device          pci0device          fdc0    at isa? port "IO_FD1" bio irq 6 drq 2 vector fdintrdevice          fd0 at fdc0 drive 0device          ncr0device          scbus0device          sc0 at isa? port "IO_KBD" tty irq 1 vector scintrdevice          npx0    at isa? port "IO_NPX" irq 13 vector npxintrdevice          da0device          da1device          da2device          sa0pseudo-device   loop            # required by INETpseudo-device   gzip            # Exec gzipped a.out'sEOM     exit 1ficp -f /sys/compile/MINI/kernel /mntgzip -c -best /sbin/init &#62; /mnt/sbin/initgzip -c -best /sbin/fsck &#62; /mnt/sbin/fsckgzip -c -best /sbin/mount &#62; /mnt/sbin/mountgzip -c -best /sbin/halt &#62; /mnt/sbin/haltgzip -c -best /sbin/restore &#62; /mnt/sbin/restoregzip -c -best /bin/sh &#62; /mnt/bin/shgzip -c -best /bin/sync &#62; /mnt/bin/synccp /root/.profile /mnt/rootcp -f /dev/MAKEDEV /mnt/devchmod 755 /mnt/dev/MAKEDEVchmod 500 /mnt/sbin/initchmod 555 /mnt/sbin/fsck /mnt/sbin/mount /mnt/sbin/haltchmod 555 /mnt/bin/sh /mnt/bin/syncchmod 6555 /mnt/sbin/restore## create the devices nodes#cd /mnt/dev./MAKEDEV std./MAKEDEV da0./MAKEDEV da1./MAKEDEV da2./MAKEDEV sa0./MAKEDEV pty0cd /## create minimum file system table#cat &#62; /mnt/etc/fstab &#60;&#60;EOM/dev/fd0a    /    ufs    rw  1  1EOM## create minimum passwd file#cat &#62; /mnt/etc/passwd &#60;&#60;EOMroot:*:0:0:Charlie &#38;:/root:/bin/shEOMcat &#62; /mnt/etc/master.passwd &#60;&#60;EOMroot::0:0::0:0:Charlie &#38;:/root:/bin/shEOMchmod 600 /mnt/etc/master.passwdchmod 644 /mnt/etc/passwd/usr/sbin/pwd_mkdb -d/mnt/etc /mnt/etc/master.passwd## umount the floppy and inform the user#/sbin/umount /mntecho "The floppy has been unmounted and is now ready."</pre></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN25059" name="AEN25059">16.11.8.2 After the Disaster</a></h3><p>The key question is: did your hardware survive? You have been doing regular backups sothere is no need to worry about the software.</p><p>If the hardware has been damaged, the parts should be replaced before attempting touse the computer.</p><p>If your hardware is okay, check your floppies. If you are using a custom boot floppy,boot single-user (type <var class="LITERAL">-s</var> at the <sampclass="PROMPT">boot:</samp> prompt). Skip the following paragraph.</p><p>If you are using the <tt class="FILENAME">boot.flp</tt> and <ttclass="FILENAME">fixit.flp</tt> floppies, keep reading. Insert the <ttclass="FILENAME">boot.flp</tt> floppy in the first floppy drive and boot the computer.The original install menu will be displayed on the screen. Select the <varclass="LITERAL">Fixit--Repair mode with CDROM or floppy.</var> option. Insert the <ttclass="FILENAME">fixit.flp</tt> when prompted. <tt class="COMMAND">restore</tt> and theother programs that you need are located in <tt class="FILENAME">/mnt2/stand</tt>.</p><p>Recover each file system separately.</p><p>Try to <tt class="COMMAND">mount</tt> (e.g. <tt class="COMMAND">mount /dev/da0a/mnt</tt>) the root partition of your first disk. If the disklabel was damaged, use <ttclass="COMMAND">disklabel</tt> to re-partition and label the disk to match the label thatyou printed and saved. Use <tt class="COMMAND">newfs</tt> to re-create the file systems.Re-mount the root partition of the floppy read-write (<tt class="COMMAND">mount -u -o rw/mnt</tt>). Use your backup program and backup tapes to recover the data for this filesystem (e.g. <tt class="COMMAND">restore vrf /dev/sa0</tt>). Unmount the file system(e.g. <tt class="COMMAND">umount /mnt</tt>). Repeat for each file system that wasdamaged.</p><p>Once your system is running, backup your data onto new tapes. Whatever caused thecrash or data loss may strike again. Another hour spent now may save you from furtherdistress later.</p></div></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="backups-floppybackups.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="disks-virtual.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Backups to Floppies</td><td width="34%" align="center" valign="top"><a href="disks.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Network, Memory, and File-Backed FileSystems</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -