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

📄 493-495.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=493-495//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="490-492.html">Previous</A></TD>

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

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

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>Table 29.1 contains options useful for <TT>mount</TT>, given in alphabetical order. Unless otherwise indicated, these options are valid for all filesystem types, although asking for asynchronous writes to a CD-ROM is no use! Options applicable only to <TT>nfs</TT> filesystems are not listed here; refer to the <TT>nfs</TT> manual page for those.</P>

<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 29.1</B> <I>mount</I> options

<TR>

<TH COLSPAN="2"><HR>

<TR>

<TH WIDTH="30%" ALIGN="LEFT">Option

<TH WIDTH="70%" ALIGN="LEFT">Description

<TR>

<TD COLSPAN="2"><HR>

<TR>

<TD VALIGN="TOP"><TT>async</TT>

<TD>Write requests for the filesystem normally should wait until the data has reached the hardware; with this option, the program continues immediately instead. This does mean that the system is slightly more prone to data loss in the event of a system crash, but, on the other hand, crashes are very rare with Linux. This option speeds up <TT>nfs</TT> filesystems by a startling extent. The opposite of this option is <TT>sync</TT>.

<TR>

<TD VALIGN="TOP"><TT>auto</TT>

<TD>Indicates to <TT>mount</TT> that it should mount the device when given the <TT>-a</TT> flag. This flag is used by the startup scripts to make sure that all the required filesystems are mounted at boot time. The opposite of this option is <TT>noauto</TT>.

<TR>

<TD VALIGN="TOP"><TT>defaults</TT>

<TD>Turns on the options <TT>rw</TT>, <TT>suid</TT>, <TT>dev</TT>, <TT>exec</TT>, <TT>auto</TT>, <TT>nouser</TT>, and <TT>async</TT>.

<TR>

<TD VALIGN="TOP"><TT>dev</TT>

<TD>Allows device nodes on the system to be used. Access to devices is completely determined by access rights to the on-disk device node. Hence, if you mount an <TT>ext2</TT> filesystem on a floppy and you have previously placed a writable <TT>/dev/kmem</TT> device file on the disk, then you&#146;ve just gained read/write access to kernel memory. System administrators generally prevent this from happening by mounting removable filesystems with the <TT>nodev</TT> <TT>mount</TT> option.

<TR>

<TD VALIGN="TOP"><TT>exec</TT>

<TD>Indicates to the kernel that it should allow the execution of programs on the filesystem. This option is more frequently seen as <TT>noexec</TT>, which indicates to the kernel that execution of programs on this filesystem shouldn&#146;t be allowed. This is generally used as a security precaution or for <TT>nfs</TT> filesystems mounted from another machine that contain executable files of a format unsuitable for this machine (for example, intended for a different CPU).

<TR>

<TD><TT>noauto</TT>

<TD>Opposite of <TT>auto</TT>; see <TT>auto</TT> table entry.

<TR>

<TD><TT>nodev</TT>

<TD>Opposite of <TT>dev</TT>; see <TT>dev</TT> table entry.

<TR>

<TD><TT>noexec</TT>

<TD>Opposite of <TT>exec</TT>; see <TT>exec</TT> table entry.

<TR>

<TD><TT>nosuid</TT>

<TD>Opposite of <TT>suid</TT>; see <TT>suid</TT> table entry.

<TR>

<TD><TT>nouser</TT>

<TD>Opposite of <TT>user</TT>; see <TT>user</TT> table entry.

<TR>

<TD VALIGN="TOP"><TT>remount</TT>

<TD>Allows the <TT>mount</TT> command to change the flags for an already-mounted filesystem without interrupting its use. You can&#146;t unmount a filesystem that is currently in use, and this option is basically a workaround. The system startup scripts, for example, use the command <TT>mount -n -o remount,ro /</TT> to change the root filesystem from read-only (it starts off this way) to read/write (its normal state). The <TT>-n</TT> option indicates to <TT>mount</TT> that it shouldn&#146;t update <TT>/etc/fstab</TT> because it can&#146;t do this while the root filesystem is still read-only.

<TR>

<TD VALIGN="TOP"><TT>ro</TT>

<TD>Mounts the filesystem read-only. This is the opposite of the option <TT>rw</TT>.

<TR>

<TD VALIGN="TOP"><TT>rw</TT>

<TD>Mounts the filesystem read/write. This is the opposite of the option <TT>ro</TT>.

<TR>

<TD VALIGN="TOP"><TT>suid</TT>

<TD>Allows the set user ID and set group ID file mode bits to take effect. The opposite of this option is <TT>nosuid</TT>. The <TT>nosuid</TT> option is more usual; it is used for the same sorts of reasons that <TT>nodev</TT> is used.

<TR>

<TD VALIGN="TOP"><TT>sync</TT>

<TD>All write operations cause the calling program to wait until the data has been committed to the hardware. This mode of operation is slower but a little more reliable than its opposite, asynchronous I/O, which is indicated by the option <TT>async</TT> (see preceding).

<TR>

<TD VALIGN="TOP"><TT>user</TT>

<TD>Allows ordinary users to mount the filesystem. When there is a <TT>user</TT> option in <TT>/etc/fstab</TT>, ordinary users indicate which filesystem they want to mount or unmount by giving the device name or mount point; all the other relevant information is taken from the <TT>/etc/fstab</TT> file. For security reasons, <TT>user</TT> implies the <TT>noexec</TT>, <TT>nosuid</TT>, and <TT>nodev</TT> options.

<TR>

<TD COLSPAN="2"><HR>

</TABLE>

<P>Options are processed by the <TT>mount</TT> command in the order in which they appear on the command line (or in <TT>/etc/fstab</TT>). Thus, it is possible to allow users to mount a filesystem and then run set user ID executables by using the options <TT>user, suid</TT>, in that order. Using them in reverse order (<TT>suid, user</TT>) doesn&#146;t work because the <TT>user</TT> option turns the <TT>suid</TT> option off again.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>&#149; For more information about using the <TT>mount</TT> command, see page 115.<HR></FONT>

</BLOCKQUOTE>

<P>There are many other options available, but these are all specific to particular filesystems. All the valid options for <TT>mount</TT> are detailed in its manual page. An example is the <TT>umask</TT> flag for the <TT>vfat</TT> and <TT>fat</TT> filesystems, which allows you to make all the files on your MS-DOS or Windows partitions readable (or even writable if you prefer) for all the users on your Linux system.</P>

<H3><A NAME="Heading5"></A><FONT COLOR="#000077">Setting Up New Filesystems</FONT></H3>

<P>When the kernel boots, it attempts to mount a root filesystem from the device specified by the kernel loader, LILO. The root filesystem is initially mounted read-only. During the boot process, the filesystems listed in the filesystem table <TT>/etc/fstab</TT> are mounted. This file specifies which devices are to be mounted, what kinds of filesystems they contain, at what point in the filesystem the mount takes place, and any options governing <I>how</I> they are to be mounted. The format of this file is described in <TT>fstab</TT>.</P>



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

<TR><TD>

<P><B>Importance of the <TT>/etc/fstab</TT> table</B><BR>Always make a backup copy of the filesystem table, <TT>/etc/fstab</TT>, before making changes to your system, such as adding additional hard drives, or editing the table. If you make a mistake in the file, your system may not boot properly or at all. With a backup copy you can easily restore your system&#146;s settings.</TABLE>



</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="490-492.html">Previous</A></TD>

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

<TD><A HREF="495-497.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 + -