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

📄 498-500.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=498-500//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="495-497.html">Previous</A></TD>

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

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

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P><FONT SIZE="+1"><B>Filesystem Options</B></FONT></P>

<P>When you create a new entry for a filesystem using <TT>cabaret</TT>, as described in the preceding sections, you are given the opportunity to change the options pertaining to it. Many options are possible, but only some of them are commonly used.</P>

<P>The options fall fairly neatly into those suitable for removable devices and those suitable for nonremovable ones.</P>

<P><FONT SIZE="+1"><B>Options Useful for Removable Devices</B></FONT></P>

<P>Removable devices like floppy disks must be mounted and unmounted in order to be used (unless you use the <TT>mtools</TT> package for floppy disks). The Users Can Mount Filesystem option (which appears as <TT>user</TT> in <TT>/etc/fstab</TT>) is required for this to happen. Conversely, for nonremovable devices like hard disk partitions, allowing just anybody to unmount the <TT>/usr</TT> filesystem would pretty much be a disaster. The various Ignore options are listed in Table 29.2.</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 29.2</B> Removable device mounting options

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TH WIDTH="50%" ALIGN="LEFT">Long Name

<TH WIDTH="50%" ALIGN="LEFT">Short Name

<TR>

<TD COLSPAN="2"><HR>

<TR>

<TD>Ignore setuid executables

<TD><TT>nosuid</TT>

<TR>

<TD>Ignore device files

<TD><TT>nodev</TT>

<TR>

<TD>Ignore executables

<TD><TT>noexec</TT>

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

<P>The first two options, <TT>nosuid</TT> and <TT>nodev</TT>, are security features, which prevent any old person from bringing along a specially prepared UNIX filesystem and using it to compromise your machine. If you have entries in your filesystem table for removable ext2 filesystems, set these two options for them.</P>

<P><FONT SIZE="+1"><B><I>Setting removable device options</I></B></FONT></P>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;Log on as the root operator. Using your favorite text editor, such as <TT>pico</TT>, open the <TT>/etc/fstab</TT> file:

<!-- CODE SNIP //-->

<PRE>

  # pico &#150;w /etc/fstab

</PRE>

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

<DD><B>2.</B>&nbsp;&nbsp;If you have a removable device, such as a Zip drive, you can make your system a bit more secure by inserting the <TT>nosuid</TT> and <TT>nodev</TT> mount options. Look for your device&#146;s entry in the <TT>fstab</TT> file: 

<!-- CODE SNIP //-->

<PRE>

  /dev/sda4  /mnt/zip    vfat

   user,noauto,dev,exec,suid    0 0

</PRE>

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

<DD><B>3.</B>&nbsp;&nbsp;Make sure the devices are not mounted. Then change the <TT>dev</TT> and <TT>suid</TT> options to <TT>nodev</TT> and <TT>nosuid</TT>, like this:

<!-- CODE SNIP //-->

<PRE>

  /dev/sda4  /mnt/zip    vfat

   user,noauto,<B>nodev</B>,exec,<B>nosuid</B>    0 0

</PRE>

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

<DD><B>4.</B>&nbsp;&nbsp;Save the <TT>fstab</TT> and quit your word processor.

</DL>

<P>The third ignore option is also sometimes used on network servers. Some filesystems are designed to be mounted only by client machines and aren&#146;t of much use to the server itself. They might, for example, contain executables for a bunch of client machines running some incompatible version of UNIX. If this is the case, you should set the <TT>noexec</TT> option so that nobody can try to run the incompatible kinds of programs.</P>

<P><FONT SIZE="+1"><B><I>Options Useful for Fixed Devices</I></B></FONT></P>

<P>Most fixed devices need to be mounted at boot time, so that option should normally be set for nonremovable devices. On the other hand, this option should not normally be set for removable devices since there often is no disk in the drive at boot time.

</P>



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

<TR><TD><FONT SIZE="+1"><B>Access timestamps and Linux</B></FONT>

<BR>Although the access timestamp is an integral part of all UNIX filesystems, including Linux&#146;s <TT>ext</TT> filesystem, disabling usually doesn&#146;t break anything. The most significant thing that this breaks is the reporting of new mail; if the modification time for your mailbox is newer than its access time, you must have received new mail since you last read mail. Conversely, if the access time is newer, you have no unread mail. This fact is used by the <TT>finger</TT> program. Some specialized systems benefit from the <TT>noatime</TT> option, particularly Usenet News servers with a lot of clients. For most other machines, this option is usually left alone.</TABLE>



<P>The writable (<TT>rw</TT>) flag is usually set, but one might unset it for CD-ROM drives that aren&#146;t writable anyway, or for filesystems containing important archive data.</P>

<P>The <TT>updateatime</TT> option is relatively new to Linux and isn&#146;t used by most people. Normally one of the three timestamps on a file is a record of the time that it was last accessed. If a filesystem is heavily read from and rarely written to, then the endless updating of access-time timestamps can lead to an unproductive waste of performance.</P>

<P>The <TT>user</TT> option is occasionally used for filesystems belonging to other operating systems; it allows ordinary users to mount Microsoft Windows filesystems (for example) and access the files on them without falling afoul of the fact that Windows (except Windows NT in some cases) does not keep track of who owns files.</P>

<P><FONT SIZE="+1"><B><I>Mount Options for NFS Filesystems</I></B></FONT></P>

<P>When you set up an NFS filesystem, the normal Options dialog box also includes an NFS Options button that allows you to customize the way the filesystem is mounted and used.

</P>

<P>Most of the <TT>nfs</TT> options are concerned with what should happen if the server machine is unreachable (because, for example, either it or the network has failed). This perhaps seems unlikely but, believe me, you&#146;ll care on the day it happens.</P>

<P>The default options just make the system keep trying indefinitely until the filesystem can be mounted. Many filesystems are essential but some are not. For nonessential filesystems, the default options are probably too conservative. For these, you should check the Retry in Background If Mount Fails checkbox. This allows your Linux system to continue to boot if the remote filesystem is not available. If a program has to use a file on the failing server, it waits until the filesystem has been mounted (the upper limit on how long this takes until it gives up is also configurable).</P>

<P>The read and write sizes are configurable. Again, the defaults are conservative and should be satisfactory. The default read and write size is 1,024 bytes (this conveniently fits inside a 1,500-byte Ethernet packet), but often the system performs much better if this size is increased to 4,096 or even 8,912 bytes (that is, 4KB or 8KB). Sometimes doing this actually makes things worse rather than better, however; it depends on the server and the quality of the network cards, as well as the amount of network traffic.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="495-497.html">Previous</A></TD>

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

<TD><A HREF="500-503.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 + -