📄 270-273.html
字号:
<HTML>
<HEAD>
<TITLE>Special Edition Using Linux, Fourth Edition:Managing File Systems</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=0789717468//-->
<!--TITLE=Special Edition Using Linux, Fourth Edition//-->
<!--AUTHOR=Jack Tackett//-->
<!--AUTHOR=Jr.//-->
<!--AUTHOR=Steve Burnett//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=14//-->
<!--PAGES=270-273//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="268-270.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="273-275.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><I>device</I> is the physical device that you want to mount; <I>mountpoint</I> is the point in the file system tree where you want it to appear.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>The <TT>mount</TT> command can be used only by superusers. This is to help ensure system security. Several software packages are available that allow users to mount specific file systems, especially floppy disks.<HR></FONT>
</BLOCKQUOTE>
<P><TT>mount</TT> accepts several command-line arguments in addition to the two mentioned above (see Table 14.3). If a needed command isn’t given, <TT>mount</TT> attempts to figure it out from the /etc/fstab file.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 14.3</B> Command-Line Arguments for the <I>mount</I> Command
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="30%" ALIGN="LEFT">Argument
<TH WIDTH="70%" ALIGN="LEFT">Description
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP"><TT>-f</TT>
<TD>Causes everything to be done except for the actual mount system call. This “fakes” mounting the file system.
<TR>
<TD VALIGN="TOP"><TT>-v</TT>
<TD>Verbose mode; provides additional information about what <TT>mount</TT> is trying to do.
<TR>
<TD><TT>-w</TT>
<TD>Mounts the file system with read and write permissions.
<TR>
<TD><TT>-r</TT>
<TD>Mounts the file system with read-only permission.
<TR>
<TD><TT>-n</TT>
<TD>Mounts without writing an entry in the /etc/mtab file.
<TR>
<TD VALIGN="TOP"><TT>-t <I>type</I></TT>
<TD>Specifies the type of the file system being mounted. Valid types are <TT>minux</TT>, <TT>ext</TT>, <TT>ext2</TT>, <TT>xiafs</TT>, <TT>msdos</TT>, <TT>hpfs</TT>, <TT>proc</TT>, <TT>nfs</TT>, <TT>umsdos</TT>, <TT>sysv</TT>, and <TT>iso9660</TT> (the default).
<TR>
<TD><TT>-a</TT>
<TD>Causes <TT>mount</TT> to try to mount all file systems in /etc/fstab.
<TR>
<TD VALIGN="TOP"><TT>-o <I>list_of_options</I></TT>
<TD>When followed by a comma-separated list of options, causes <TT>mount</TT> to apply the options specified to the file system being mounted. Many options are available here; for a complete list, refer to the <TT>mount</TT> man page.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>NOTE: </B>Several forms of the <TT>mount</TT> command are very common. For example, the command <TT>mount /dev/hdb3 /mnt</TT> will mount the hard disk partition /dev/hdb3 under the directory /mnt. Similarly, <TT>mount -r -t iso9660/dev/sr0 /mnt</TT> mounts the SCSI CD-ROM drive /dev/sr0, which is read-only and of the ISO 9660 file format, under the directory /mnt. And the command <TT>mount -vat nfs</TT> mounts all the NFS file systems listed in the /etc/fstab file.<HR></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B>If a file system doesn’t mount correctly, use the command <TT>mount -vf <I>device mountpoint</I></TT>v to see what <TT>mount</TT> is doing. This gives a verbose listing and tells <TT>mount</TT> to do everything except mount the file system. This way, you can fake out the <TT>mount</TT> command and get a lot of information about what it’s trying to do.<HR></FONT>
</BLOCKQUOTE>
<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">Mounting File Systems at Boot Time</FONT></H4>
<P>Under most circumstances, the file systems that your Linux system uses won’t change frequently. For this reason, you can easily specify a list of file systems that Linux mounts when it boots and that it unmounts when it shuts down. These file systems are listed in a special configuration file named /etc/fstab, for <I>file system table</I>.</P>
<P>The /etc/fstab file lists the file systems to be mounted, one file system per line. The fields in each line are separated by spaces or tabs. Table 14.4 lists the different fields in the /etc/fstab file.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 14.4</B> Fields in the /etc/fstab File
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="30%" ALIGN="LEFT">Field
<TH WIDTH="70%" ALIGN="LEFT">Description
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TD VALIGN="TOP">File system specifier
<TD>Specifies the block special device or the remote file system to be mounted.
<TR>
<TD VALIGN="TOP">Mount point
<TD>Specifies the mount point for the file system. For special file systems such as swap files, use the word <TT>none</TT>, which makes swap files active but not visible within the file tree.
<TR>
<TD VALIGN="TOP">Type
<TD>Gives the file system type of the specified file system. The following types of file systems are supported:
<TR>
<TD>
<TD><TT>minix</TT>: a local file system supporting filenames of 14 or 30 characters
<TR>
<TD>
<TD><TT>ext</TT>: a local file system with longer filenames and larger inodes (this file system has been replaced by the <TT>ext2</TT> file system and should no longer be used)
<TR>
<TD>
<TD><TT>ext2</TT>: a local file system with longer filenames, larger inodes, and other features
<TR>
<TD>
<TD><TT>xiafs</TT>: a local file system
<TR>
<TD>
<TD><TT>msdos</TT>: a local file system for MS-DOS partitions
<TR>
<TD>
<TD><TT>hpfs</TT>: a local file system for OS/2 High Performance File System partitions
<TR>
<TD>
<TD><TT>iso9660</TT>: a local file system used for CD-ROM drives
<TR>
<TD>
<TD><TT>nfs</TT>: a file system for mounting partitions from remote systems
<TR>
<TD>
<TD><TT>swap</TT>: a disk partition or special file used for swapping
<TR>
<TD>
<TD><TT>umsdos</TT>: a UMSDOS file system
<TR>
<TD>
<TD><TT>sysv</TT>: a System V file system
<TR>
<TD VALIGN="TOP">Mount Options
<TD>A comma-separated list of mount options for the file system. At a minimum, it must contain the type of mount for the file system. See the <TT>mount</TT> man page for more information on mount options.
<TR>
<TD VALIGN="TOP">Dump Frequency
<TD>Specifies how often the file system should be backed up by the <TT>dump</TT> command. If this field isn’t present, <TT>dump</TT> assumes that the file system doesn’t need to be backed up.
<TR>
<TD VALIGN="TOP">Pass Number
<TD>Specifies in what order the file systems should be checked by the <TT>fsck</TT> command when the system is booted. The root file system should have a value of 1. All other file systems should have a value of 2. If a value isn’t specified, the file system won’t be checked for consistency at boot time.
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B>It’s recommended that you mount your file systems at boot time via the /etc/fstab file instead of by using the <TT>mount</TT> command. Remember, only superusers can use <TT>mount</TT>.<HR></FONT>
</BLOCKQUOTE>
<P>The following is a sample fstab file:
</P>
<!-- CODE SNIP //-->
<PRE>
# device directory type options
/dev/hda1 / ext2 defaults
/dev/hda2 /usr ext2 defaults
/dev/hda3 none swap sw
/dev/sda1 /dosc msdos defaults
/proc /proc proc none
</PRE>
<!-- END CODE SNIP //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="268-270.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="273-275.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 + -