📄 487-490.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=487-490//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch28/485-486.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="490-492.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H2><A NAME="Heading1"></A><FONT COLOR="#000077">CHAPTER 29<BR>Managing the Filesystem
</FONT></H2>
<P><I>By James Youngman</I></P>
<DL>
<DD>Mounting hard drives and other filesystems
<DD>Mounting disks with Red Hat’s <TT>usermount</TT> command
<DD>Mounting filesystems with the <TT>mount</TT> command
<DD>Preparing and mounting filesystems with Red Hat’s <TT>cabaret</TT> tool
<DD>Setting up filesystems with Red Hat’s <TT>fstool</TT> command
<DD>Editing the filesystem table <TT>/etc/fstab</TT>
<DD>Repairing damaged filesystems
<DD>Restoring Linux system files
</DL>
<H3><A NAME="Heading2"></A><FONT COLOR="#000077">Mounting and Unmounting Filesystems</FONT></H3>
<P>The filesystems on your hard disk drives are mounted for you automatically when the system boots. The removable devices (for example, floppy disks and CD-ROM drives) are not.
</P>
<P>All of the people using a Linux machine see the same view of the filesystem (although many of them are unable to access all parts of it). This means that mounting a filesystem is an action reserved for the superuser. The superuser can indicate that some filesystems can be mounted and unmounted by ordinary users (the <TT>user</TT> option in the file <TT>/etc/fstab</TT> is used for this).</P>
<P>The superuser sets up the <TT>/etc/fstab</TT> file to specify what filesystems are used on each device, using either the <TT>cabaret</TT> command, the Red Hat control panel, or by using a text editor directly on the <TT>/etc/fstab</TT> file.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>• To learn more about being a superuser and using the <TT><I>su</I></TT> command with Linux, see page 5.<HR></FONT>
</BLOCKQUOTE>
<H4 ALIGN="LEFT"><A NAME="Heading3"></A><FONT COLOR="#000077">Using the <I>usermount</I> Command
</FONT></H4>
<P>Red Hat Linux comes with a command called <TT>usermount</TT> that provides a GUI interface for mounting and unmounting filesystems. The <TT>usermount</TT> command must be run during an X11 session. When you start <TT>usermount</TT>, it shows you what filesystems you can <I>mount</I> (or format). The <TT>usermount</TT> program is shown in Figure 29.1.</P>
<P><A NAME="Fig1"></A><A HREF="javascript:displayWindow('images/29-01.jpg',326,298 )"><IMG SRC="images/29-01t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/29-01.jpg',326,298)"><FONT COLOR="#000077"><B>Figure 29.1</B></FONT></A> The <TT>usermount</TT> program.
</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>• To learn more about the X Window System, see page 260.<HR></FONT>
</BLOCKQUOTE>
<P>The buttons for <TT>/mnt/cdrom</TT> (the CD-ROM drive) and <TT>/mnt/floppy</TT> (the floppy disk drive) are labeled Mount and Format. If you click the Mount button with a disk in the drive, the disk is mounted and the button changes to Unmount, as shown in Figure 29.2.</P>
<P><A NAME="Fig2"></A><A HREF="javascript:displayWindow('images/29-02.jpg',326,298 )"><IMG SRC="images/29-02t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/29-02.jpg',326,298)"><FONT COLOR="#000077"><B>Figure 29.2</B></FONT></A> The disk is mounted and the button changes to Unmount.</P>
<P>If you try to mount the floppy disk (<TT>/dev/fd0</TT>) without having a disk in the drive, you receive an error message in a dialog box similar to the one shown in Figure 29.3.</P>
<P><A NAME="Fig3"></A><A HREF="javascript:displayWindow('images/29-03.jpg',260,123 )"><IMG SRC="images/29-03t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/29-03.jpg',260,123)"><FONT COLOR="#000077"><B>Figure 29.3</B></FONT></A> Mounting without the disk in the drive results in this dialog box.</P>
<P><FONT SIZE="+1"><B><I>Formatting a floppy disk with usermount</I></B></FONT></P>
<DL>
<DD><B>1.</B> To format a floppy disk with the <TT>usermount</TT> command, your system must be set up so that you are allowed (have permission) to write to the floppy disk drive.
<DD><B>2.</B> Insert a blank disk in your disk drive, and start the <TT>usermount</TT> command from the command line of a terminal window like this:
<!-- CODE SNIP //-->
<PRE>
# usermount
</PRE>
<!-- END CODE SNIP //-->
<DD><B>3.</B> The Format button is active for the floppy drive. Ensure that there is no data that you want to keep in the drive before clicking this button.
<DD><B>4.</B> Click the Format button. A dialog box appears, asking if you are sure. There is also a checkbox on the dialog box that asks if you want to do a low-level format (as shown in Figure 29.4).
<P><A NAME="Fig4"></A><A HREF="javascript:displayWindow('images/29-04.jpg',236,152 )"><IMG SRC="images/29-04t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/29-04.jpg',236,152)"><FONT COLOR="#000077"><B>Figure 29.4</B></FONT></A> Specify whether you want to do a low-level format.</P>
<BR>If you don’t elect to do the low-level format because the disk has already been formatted, Linux builds a new, clean filesystem on the disk, which takes a second or so. A low-level format, on the other hand, takes quite a while.
</DL>
<P>Although you can reformat your hard disk partitions by using Linux’s <TT>fdisk</TT> and <TT>mkfs</TT> programs, they are omitted from the <TT>usermount</TT> program in the interests of safety.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>• For more information about using or setting permissions, see page 418.<HR></FONT>
</BLOCKQUOTE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch28/485-486.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="490-492.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 + -