📄 513-517.html
字号:
<HTML>
<HEAD>
<TITLE>Using Linux:Managing the Filesystem</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789716232//-->
<!--TITLE=Using Linux//-->
<!--AUTHOR=William Ball//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=29//-->
<!--PAGES=513-517//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="510-513.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch30/517-521.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading13"></A><FONT COLOR="#000077">Disaster Recovery</FONT></H3>
<P>Easy disaster recovery, in computing as in life, requires forward planning. This means making regular backups of your computer, and checking that those backups work properly.
</P>
<P>The actual backup process is covered in Chapter 31, “System Maintenance,” but here we discuss the other aspects of disaster recovery.</P>
<H4 ALIGN="LEFT"><A NAME="Heading14"></A><FONT COLOR="#000077">What’s Vital and What Isn’t?</FONT></H4>
<P>There was a time when PC floppy disks were 360KB and hard disks were 10MB. A complete system backup might fit onto 30 floppy disks. A few years later, floppies were 1.44MB and hard disks were 100MB—that’s over 60 floppies. Today, floppy disks are still the same size but disks are 4GB. Even if you could buy 3,000 floppy disks, system backups would be ridiculously impractical.
</P>
<P>There are many solutions to this problem. Floppy disks are no longer viable for backups of a whole system. Tapes and recordable CDs are perfectly good in their place.</P>
<P>A useful backup strategy takes into account several things:</P>
<DL>
<DD><B>•</B> What is the maximum acceptable downtime?
<DD><B>•</B> How much data must be backed up?
<DD><B>•</B> How quickly does the data change?
<DD><B>•</B> What backup devices are available?
</DL>
<P>If all the data you need to back up will fit on your backup device, then the simplest solution works best—back everything up, every time.
</P>
<P>If a complete backup every time is impractical, you have to find a balance between the risk to your data and the cost of making backups. As an example, my own system has almost 4GB of filesystems. Much of this is occupied by the operating system and could easily be restored from the installation CD-ROM. Of the rest, the majority consists of packages either from CDs or downloaded from the Internet (WINE, POV, Gnome, LCLint, and so on). These come to over half a gigabyte. All these things can either be reinstalled from the CDs or downloaded again.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>• For more information about doing system backups for Linux, see page 542.<HR></FONT>
</BLOCKQUOTE>
<P>Altogether, the files on which I work actively come to under 100MB, including the intermediate compiler output files, which don’t really need to be backed up. I keep these files separate from the things that I don’t work on. So, for me it is practical to back up my vital data to a series of floppy disks. This is not ideal, but it’s reasonable. This strategy is only possible because the filesystem is organized so as to keep the various kinds of data separate; I don’t mix my own files (which I have to keep safe) with downloaded packages or documents (which I can delete).
</P>
<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD><FONT SIZE="+1"><B>Nontraditional backup devices</B></FONT>
<BR>If you don’t have a traditional kind of backup device, this does not mean that you cannot back up your important data. See your backup device’s documentation for more information, and remember that backing up is absolutely crucial.</TABLE>
<H4 ALIGN="LEFT"><A NAME="Heading15"></A><FONT COLOR="#000077">When to Back Up</FONT></H4>
<P>When you have a catastrophe, you will lose everything modified since it was last backed up. So, there are two factors that determine how often you back your data up: what the capacity of your backup device is and how much suffering you can bear.
</P>
<H4 ALIGN="LEFT"><A NAME="Heading16"></A><FONT COLOR="#000077">What to Do with the Backups</FONT></H4>
<P>After you’ve backed up your data, the three most important things to do are as follows:
</P>
<DL>
<DD><B>•</B> Write-protect the media—There’s nothing worse than trying to restore from backup in a panic and accidentally deleting the backup.
<DD><B>•</B> Label your backup—If you can’t identify the most recent backup when you need it, it’s no use. Keep your backups in a safe place.
<DD><B>•</B> Test your backup—Make sure you can restore from it.
</DL>
<P>This last point is particularly important. Many people have a backup routine that they follow day in and day out but find out only too late that their backups are useless. A cautionary tale that sticks in my memory is that of a vendor of backup software whose code had a bug; it would make multivolume backups, but the second and following volumes were useless and could not be read back. Unfortunately, they used their own software to back up their systems and amazingly had never done a trial restore with their tapes.
</P>
<H4 ALIGN="LEFT"><A NAME="Heading17"></A><FONT COLOR="#000077">Reviewing Your Backup Strategy</FONT></H4>
<P>Don’t forget to periodically reconsider your backup strategy. Circumstances change; your data may grow, or it may suddenly be more important that you be able to recover from backup suddenly. For example, while writing this chapter I added up the size of my working data and realized it was larger than I thought. Part of my next paycheck will go on a large r backup device; probably a SCSI tape drive or (if I can afford it) a CD-ROM recorder.
</P>
<H4 ALIGN="LEFT"><A NAME="Heading18"></A><FONT COLOR="#000077">Coping with Disaster</FONT></H4>
<P>When the worst happens, it’s important to be extra careful about what you do. If you’ve just typed <TT>rm -rf /tmp *</TT> instead of <TT>rm -rf /tmp/*</TT>, then by all means immediately interrupt this. Once you realize that data has been lost, take a moment to calm down and review your options. Determine the answers to these questions:</P>
<DL>
<DD><B>1.</B> What data has been lost?
<DD><B>2.</B> Where is my most recent backup?
<DD><B>3.</B> Where is my system installation media (boot disk and installation CD-ROM)?
</DL>
<P><FONT SIZE="+1"><B>Restoring System Files</B></FONT></P>
<P>If you’ve just lost a few system files, you might be able to fix everything by reinstalling a few packages from the CD-ROM. People with even quite badly destroyed systems have recovered simply by booting from the installation floppy and selecting Upgrade. The Red Hat upgrade process can replace only missing files. If the destruction is more extensive, you may need to consider reinstalling from scratch.
</P>
<P>Strictly speaking, it is quite possible to recover from losing almost everything just by booting the installation floppy in <TT>rescue</TT> mode and knowing how to haul yourself up by your bootstraps. However, if you’re not an expert, you may find a reinstallation easier. If you do this, however, the installation process will destroy any data on partitions that the operating system installs onto. That is, if you only have one file system, <TT>/</TT>, then a reinstall will delete the contents of your home directory, too. If you have your <TT>/home</TT> file system on a separate drive, then the reinstall will not delete it (unless you tell it to format that partition by accident).</P>
<P>If a reinstall would destroy your own data and you have no useful backup, you’re in a tight spot. The best approach is to avoid the reinstall, perhaps by recruiting the help of an expert. Lastly, if you do reinstall your system, consider putting your own important data on a separate filesystem (<TT>/home</TT>, for example).</P>
<P><FONT SIZE="+1"><B>Restoring User Files</B></FONT></P>
<P>After the system files are taken care of, you can restore your own data from a backup. The actual details of this are explained in Chapter 31.
</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="510-513.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch30/517-521.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -