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

📄 558-561.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Using Linux:System Maintenance</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=31//-->

<!--PAGES=558-561//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="554-557.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="561-564.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>To use floppy disks as storage devices, you must know the device name your floppy disk drive uses. Usually, this is <TT>/dev/fd0</TT>, but you may need to do some snooping to verify this&#151;one way to snoop is to try the procedures for formatting or mounting floppies (described later in this section) on different device files (<TT>/dev/fd0</TT>, <TT>/dev/fd1</TT>, and so on). Then you must mount a preformatted floppy disk (you must have more than one disk handy, so format extras if you need to). You can do a low-level format (similar to the one performed by the MS-DOS command <TT>format</TT>) using the <TT>fdformat</TT> utility to preformat a floppy:</P>

<!-- CODE SNIP //-->

<PRE>

#fdformat /dev/fd0

</PRE>

<!-- END CODE SNIP //-->

<P>After the floppy disk has been formatted with <TT>fdformat</TT>, you must configure it for the <TT>ext2</TT> file system. The <TT>mkfs</TT> command sets up the parameters for the Linux Second Extended file system:</P>

<!-- CODE SNIP //-->

<PRE>

#mkfs -t ext2 /dev/fd0 1440

</PRE>

<!-- END CODE SNIP //-->



<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">

<TR><TD>

<P><B>Use <TT>fdformat</TT> with care</B><BR>Using <TT>fdformat</TT> erases all data on the floppy disk. Try mounting and reading from it (using the <TT>mount</TT> and <TT>ls</TT> commands) to make sure it is empty before formatting if you're not sure.</TABLE>



</P>

<P>The <TT>1440</TT> indicates that the floppy disk contains 1,440 kilobytes of storage, or 1.44 MB).</P>

<P>Finally, we can mount the floppy disk by using the default mount point <TT>/mnt/floppy</TT>.</P>

<!-- CODE SNIP //-->

<PRE>

#mount -t ext2 /dev/fd0 /mnt/floppy

</PRE>

<!-- END CODE SNIP //-->

<P>Be sure to use one mount point per mounted device. Now that you have a mounted floppy disk at your disposal, you can start to back up information onto it:

</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvfz /dev/fd0 files

</PRE>

<!-- END CODE SNIP //-->

<P>The preceding command creates an archive on the device <TT>/dev/fd0</TT>. Note that in this command, you use the name of a device and not the <TT>tarfile.tar</TT> filename structure. <TT>tar</TT> recognizes that <TT>/dev/fd0</TT> is a device, but allows you to treat the device like an archive file. Usually, when backing up onto floppy disks, you will use the <TT>M </TT>option with <TT>tar</TT> to signify that this is a backup with multiple volumes.</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzMf /dev/fd0 files

</PRE>

<!-- END CODE SNIP //-->

<P><TT>tar</TT> prompts you when you need to change floppy disks. Make sure you mark the disk order number on each floppy used, or you will have problems when you try to restore the archive.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>SEE ALSO</B>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;For more information about formatting and mounting devices, see page 99.

<DD><B>&#149;</B>&nbsp;&nbsp;For more information about the <TT>tar</TT> command, see page 544.

</DL>

<HR></FONT>

</BLOCKQUOTE>

<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">Backing Up with Removable Drives</FONT></H4>

<P>If you plan to use removable tape drives connected to your floppy disk controller for backups, you must determine the device file associated with your tape drive. Usually, tape drives are divided into two types: rewindable (represented by the device files <TT>/dev/rft0,</TT> <TT>/dev/rft1</TT>, <TT>/dev/rft2</TT>, and so on) and non-rewindable (represented by the device files <TT>/dev/nrft0</TT>, <TT>/dev/nrft1</TT>, <TT>/dev/nrft2</TT>, and so on). <I>Rewindable</I> tape devices rewind the tape automatically after <TT>tar</TT> finishes writing an archive to the tape, so they are best used when you use a tape for only one archive file. <I>Non-rewindable</I> tape devices do not automatically rewind after <TT>tar</TT> finishes, so you can place several archive files, one after the other, on one tape.</P>

<P>Consider the following commands:</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzf /dev/rft0 /usr/doc

</PRE>

<!-- END CODE SNIP //-->

<P>When used with a rewindable tape drive, this <TT>tar</TT> command creates a compressed archive of all the Red Hat documentation installed on your main system. After the command has finished running, the tape rewinds automatically. Running <TT>tar</TT> again on the same tape overwrites this archive (so label your tapes well). Conversely, with a non-rewindable tape drive, you can put several successive archives on one tape.</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzf /dev/nrft0 /usr/src

</PRE>

<!-- END CODE SNIP //-->

<P>This command creates an archive of all the standard source code on the main system. Assuming there is enough space left on the tape, after this command runs you can run another <TT>tar</TT> command to create a second archive on the tape.</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzf /dev/nrft0 /usr/lib

</PRE>

<!-- END CODE SNIP //-->

<P>This command is not the same as using <TT>tar</TT> with the <TT>-A</TT> function to append files to an existing archive. This command creates a second archive, distinct from the first, on the device <TT>/dev/nrft0</TT>. To restore the second archive, you must use the <TT>mt</TT> command to skip over the first archive file on the tape:</P>

<!-- CODE SNIP //-->

<PRE>

#mt /dev/nrft0 fsf 1

</PRE>

<!-- END CODE SNIP //-->

<P>If you use another kind of drive for backups, you can substitute the device file it uses for the previous floppy tape device files. So, if you use a SCSI tape device, for instance, you&#146;d indicate it with the nomenclature <TT>/dev/st0</TT>, as follows:</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzf /dev/st0 /home

</PRE>

<!-- END CODE SNIP //-->

<P>Likewise, if you use an Iomega Zip drive on a SCSI port, you would use the <TT>/dev/sda1</TT> drive (<TT>sda1</TT> usually refers to the first SCSI device that is removable, but not a tape):</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzf /dev/sda1 /home

</PRE>

<!-- END CODE SNIP //-->

<P>The device you use depends on the device that the kernel supports . To check available devices, you can run <TT>mount</TT> with no arguments:</P>

<!-- CODE SNIP //-->

<PRE>

#mount

/dev/hda5 on / type ext2 (rw)

/dev/hda7 on /usr type ext2 (rw)

/dev/fd0 on /mnt/floppy type msdos (rw)

/dev/sda1 on /mnt/zip type ext2 (rw)

</PRE>

<!-- END CODE SNIP //-->

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>SEE ALSO</B>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;For more information about formatting and mounting devices, see page 99.

<DD><B>&#149;</B>&nbsp;&nbsp;For more information about using tape drives and Iomega Zip drives with Red Hat Linux 5.0, see page 119.

<DD><B>&#149;</B>&nbsp;&nbsp;For more information about the <TT>tar</TT> command, see page 544.

</DL>

<HR></FONT>

</BLOCKQUOTE>

<P><FONT SIZE="+1"><B>Automating Incremental Backups</B></FONT></P>

<P>You can use the <TT>find</TT> and <TT>tar</TT> commands to automatically back up files that have changed since the last time the entire system was backed up. Backing up the entire system, called a <I>full backup</I>, usually involves backing up everything that was created or changed after the initial installation. There is little need to include in a full backup most packages that can be reloaded with <TT>rpm</TT> or <TT>glint</TT>, because these packages exist on separate devices. However, if you have added some utilities via ftp from the Internet, or have lost the original disks that packages came on, you should make sure you have at least one good backup copy.</P>

<P>If you have enough room on tapes, a full backup can be simple:</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzMf /dev/rft0 /

</PRE>

<!-- END CODE SNIP //-->

<P>Or, you could be more selective:

</P>

<!-- CODE SNIP //-->

<PRE>

#tar -cvzMf /dev/rft0 /etc /var /sbin /usr/local /home

</PRE>

<!-- END CODE SNIP //-->

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="554-557.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="561-564.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 + -