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

📄 503-505.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 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=503-505//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="500-503.html">Previous</A></TD>

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

<TD><A HREF="505-508.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>The first four entries are the <TT>ext2</TT> filesystems comprising my Linux system. When Linux is booted, the root filesystem is mounted first; all the other local (that is, non-network) filesystems are mounted next.</P>

<P>The following three filesystems are all removable filesystems: two CD-ROM drives and a floppy disk drive. These have the <TT>noauto</TT> option set so that they are not automatically mounted at boot time. These removable devices have the <TT>user</TT> option set so that I can mount and unmount them without having to use <TT>su</TT> all the time. The CD-ROMs have the filesystem type <TT>iso9660</TT>, which is the standard filesystem for CD-ROMs, and the floppy drive has the filesystem type <TT>vfat</TT>, because I often use it for interchanging data with MS-DOS and Windows systems.</P>

<P><TT>/proc</TT> is a special filesystem provided by the kernel as a way of providing information about the system to user programs. The information in the <TT>/proc</TT> filesystem is used in order to make utilities such as <TT>ps</TT>, <TT>top</TT>, <TT>xload</TT>, <TT>free</TT>, <TT>netstat</TT>, and so on, work. Some of the &#147;files&#148; in <TT>/proc</TT> are really enormous (for example, <TT>/proc/kcore</TT>) but don&#146;t worry&#151;all the information in the <TT>/proc</TT> filesystem is generated on-the-fly by the Linux kernel as you read it; no disk space is wasted. You can tell that they are not real files because, for example, root can&#146;t give them away with <TT>chown</TT>.</P>

<P>The final &#147;filesystem&#148; isn&#146;t, in fact, a filesystem at all; it is an entry that indicates a disk partition used as swap space. Swap partitions are used to implement virtual memory. Files can also be used for swap space. The names of the swap files go in the first column where the device name usually goes.</P>

<P>The two numeric columns on the right relate to the operation of the <TT>dump</TT> and <TT>fsck</TT> commands, respectively. The <TT>dump</TT> command compares the number in column five (the <I>dump interval</I>) with the number of days since that filesystem was last backed up so that it can inform the system administrator that the filesystem needs to be backed up. Other backup software&#151;for example, Amanda&#151;can also use this field for the same purpose. (Amanda can be found at the URL <A HREF="http://www.cs.umd.edu/projects/amanda/amanda.html">http://www.cs.umd.edu/projects/amanda/amanda.html</A>.) Filesystems without a dump interval field are assumed to have a dump interval of zero, denoting &#147;never dump.&#148; For more information, see the manual page for <TT>dump</TT>.</P>

<P>The sixth column is the <TT>fsck pass</TT>, which indicates the filesystems that can be checked in parallel at boot time. The root filesystem is always checked first, but after that, separate drives can be checked simultaneously, Linux being a multitasking operating system. There is no point, however, in checking two filesystems on the same hard drive at the same time, because this results in lots of extra disk head movement and wasted time. All the filesystems that have the same pass number are checked in parallel, from 1 upward. Filesystems with a <TT>0</TT> or missing pass number (such as the floppy and CD-ROM drives) are not checked at all.</P>

<H3><A NAME="Heading10"></A><FONT COLOR="#000077">Creating New Filesystems Manually</FONT></H3>

<P>When you install Red Hat Linux, the installation process makes some new filesystems and sets the system up to use them. You can format new filesystems by using <TT>cabaret</TT>, as described in the earlier section &#147;Creating New Filesystems with <TT>cabaret</TT>,&#148; but you can also do this manually.</P>

<P>Many operating systems don&#146;t distinguish between the preparation of the device&#146;s surface to receive data (formatting) and the building of new filesystems. Linux does distinguish between the two, principally because only floppy disks need formatting in any case, and also because Linux offers as many as half a dozen different filesystems that can be created (on any block device).</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>&#149; For a list of a number of different filesystems for Linux, see Table 7.1 on page 94.<HR></FONT>

</BLOCKQUOTE>

<P>Linux provides a generic command, <TT>mkfs</TT>, that enables you to make a filesystem on a block device. In fact, because UNIX manages almost all resources with the same set of operations, <TT>mkfs</TT> can be used to generate a filesystem inside an ordinary file! Because this is unusual, <TT>mkfs</TT> asks for confirmation before proceeding. When this is done, you can even mount the resulting filesystem using the loop device.</P>

<P>Because of the tremendous variety of filesystems available, almost all the work of building the new filesystem is delegated to a separate program for each; however, the generic <TT>mkfs</TT> program provides a single interface for invoking them all. It&#146;s not uncommon to pass options to the top-level <TT>mkfs</TT> (for example, <TT>-V</TT> to make it show what commands it executes or <TT>-c</TT> to make it check the device for bad blocks). The generic <TT>mkfs</TT> program also enables you to pass options to the filesystem-specific <TT>mkfs</TT>. There are many of these filesystem-dependent options, but most of them have sensible defaults, and you normally would not want to change them.</P>

<P>The only options you might want to pass to <TT>mke2fs</TT>, which builds <TT>ext2</TT> filesystems, are <TT>-m</TT> and <TT>-i</TT>. The <TT>-m</TT> option specifies how much of the filesystem is reserved for root&#146;s use (for example, for working space when the system disk would otherwise have filled completely). The <TT>-i</TT> option is more rarely exercised and is used for setting the balance between inodes and disk blocks; it is related to the expected average file size. As stated previously, the defaults are reasonable for most purposes, so these options are used only in special circumstances.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="500-503.html">Previous</A></TD>

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

<TD><A HREF="505-508.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 + -