summaryrefslogtreecommitdiffstats
path: root/slackbook/html/filesystem-structure-mounting.html
diff options
context:
space:
mode:
Diffstat (limited to 'slackbook/html/filesystem-structure-mounting.html')
-rw-r--r--slackbook/html/filesystem-structure-mounting.html184
1 files changed, 184 insertions, 0 deletions
diff --git a/slackbook/html/filesystem-structure-mounting.html b/slackbook/html/filesystem-structure-mounting.html
new file mode 100644
index 000000000..e09694e40
--- /dev/null
+++ b/slackbook/html/filesystem-structure-mounting.html
@@ -0,0 +1,184 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta name="generator" content="HTML Tidy, see www.w3.org" />
+<title>Mounting Devices</title>
+<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
+<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
+<link rel="UP" title="Filesystem Structure" href="filesystem-structure.html" />
+<link rel="PREVIOUS" title="Links" href="filesystem-structure-links.html" />
+<link rel="NEXT" title="NFS Mounts" href="filesystem-structure-nfs.html" />
+<link rel="STYLESHEET" type="text/css" href="docbook.css" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+</head>
+<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
+alink="#0000FF">
+<div class="NAVHEADER">
+<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
+cellspacing="0">
+<tr>
+<th colspan="3" align="center">Slackware Linux Essentials</th>
+</tr>
+
+<tr>
+<td width="10%" align="left" valign="bottom"><a href="filesystem-structure-links.html"
+accesskey="P">Prev</a></td>
+<td width="80%" align="center" valign="bottom">Chapter 9 Filesystem Structure</td>
+<td width="10%" align="right" valign="bottom"><a href="filesystem-structure-nfs.html"
+accesskey="N">Next</a></td>
+</tr>
+</table>
+
+<hr align="LEFT" width="100%" />
+</div>
+
+<div class="SECT1">
+<h1 class="SECT1"><a id="FILESYSTEM-STRUCTURE-MOUNTING"
+name="FILESYSTEM-STRUCTURE-MOUNTING">9.4 Mounting Devices</a></h1>
+
+<p>As was previously discussed in <a
+href="system-configuration.html#SYSTEM-CONFIGURATION-LAYOUT">Section 4.1.1</a>, all the
+drives and devices in your computer are one big filesystem. Various hard drive
+partitions, CD-ROMs, and floppies are all placed in the same tree. In order to attach
+these drives to the filesystem so that you can access them, you have to use the <tt
+class="COMMAND">mount</tt>(1) and <tt class="COMMAND">umount</tt>(1) commands.</p>
+
+<p>Some devices are automatically mounted when you boot up your computer. These are
+listed in the <tt class="FILENAME">/etc/fstab</tt> file. Anything that you want to be
+mounted automatically gets an entry in that file. For other devices, you'll have to issue
+a command every time you want to use the device.</p>
+
+<div class="SECT2">
+<h2 class="SECT2"><a id="AEN3319" name="AEN3319">9.4.1 <tt
+class="FILENAME">fstab</tt></a></h2>
+
+<p>Let's look at an example of the <tt class="FILENAME">/etc/fstab</tt> file:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cat /etc/fstab</kbd>
+/dev/sda1 / ext2 defaults 1 1
+/dev/sda2 /usr/local ext2 defaults 1 1
+/dev/sda4 /home ext2 defaults 1 1
+/dev/sdb1 swap swap defaults 0 0
+/dev/sdb3 /export ext2 defaults 1 1
+none /dev/pts devpts gid=5,mode=620 0 0
+none /proc proc defaults 0 0
+/dev/fd0 /mnt ext2 defaults 0 0
+/dev/cdrom /mnt/cdrom iso9660 ro 0 0
+</pre>
+</td>
+</tr>
+</table>
+
+<p>The first column is the device name. In this case, the devices are five partitions
+spread out across two SCSI hard drives, two special filesystems that don't need a device,
+a floppy, and a CD-ROM drive. The second column is where the device will be mounted. This
+needs to be a directory name, except in the case of a swap partition. The third column is
+the filesystem type of the device. For normal Linux filesystems, this will be <var
+class="LITERAL">ext2</var> (second extended filesystem). CD-ROM drives are <var
+class="LITERAL">iso9660</var>, and Windows-based devices will either be <var
+class="LITERAL">msdos</var> or <var class="LITERAL">vfat</var>.</p>
+
+<p>The fourth column is a listing of options that apply to the mounted filesystem.
+defaults is fine for just about everything. However, read-only devices should be given
+the <var class="LITERAL">ro</var> flag. There are a lot of options that can be used.
+Check the <tt class="FILENAME">fstab</tt>(5) man page for more information. The last two
+columns are used by <tt class="COMMAND">fsck</tt> and other commands that need to
+manipulate the devices. Check the man page for that information as well.</p>
+
+<p>When you install Slackware Linux, the setup program will build much of the <tt
+class="FILENAME">fstab</tt> file.</p>
+</div>
+
+<div class="SECT2">
+<h2 class="SECT2"><a id="AEN3340" name="AEN3340">9.4.2 <tt class="COMMAND">mount</tt> and
+<tt class="COMMAND">umount</tt></a></h2>
+
+<p>Attaching another device to your filesystem is easy. All you have to do is use the <tt
+class="COMMAND">mount</tt> command, along with a few options. Using <tt
+class="COMMAND">mount</tt> can simplified if the device has an entry in the <tt
+class="FILENAME">/etc/fstab</tt> file. For example, let's say that I wanted to mount my
+CD-ROM drive and that my <tt class="COMMAND">fstab</tt> file looked like the example from
+the previous section. I would call <tt class="COMMAND">mount</tt> like so:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd class="USERINPUT">mount /cdrom</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>Since there is an entry in <tt class="FILENAME">fstab</tt> for that mount point, <tt
+class="COMMAND">mount</tt> knows what options to use. If there wasn't an entry for that
+device, I would have to use several options for <tt class="COMMAND">mount</tt>:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">%</samp> <kbd
+class="USERINPUT">mount -t iso9660 -o ro /dev/cdrom /cdrom</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>That command line includes the same information as the example <tt
+class="FILENAME">fstab</tt> did, but we'll go over all the parts anyways. The <var
+class="OPTION">-t iso9660</var> is the filesystem type of the device to mount. In this
+case, it would be the iso9660 filesystem which is what CD-ROM drives most commonly use.
+The <var class="OPTION">-o ro</var> tells mount to mount the device read-only. The <tt
+class="FILENAME">/dev/cdrom</tt> is the name of the device to mount, and <tt
+class="FILENAME">/cdrom</tt> is the location on the filesystem to mount the drive.</p>
+
+<p>Before you can remove a floppy, CD-ROM, or other removable device that is currently
+mounted, you'll have to unmount it. That is done using the <tt
+class="COMMAND">umount</tt> command. Don't ask where the &#8220;n&#8221; went because we
+couldn't tell you. You can use either the mounted device or the mount point as the
+argument to <tt class="COMMAND">umount</tt>. For example, if you wanted to unmount the
+CD-ROM from the previous example, either of these commands would work:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">umount /dev/cdrom</kbd>
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">umount /cdrom</kbd>
+</pre>
+</td>
+</tr>
+</table>
+</div>
+</div>
+
+<div class="NAVFOOTER">
+<hr align="LEFT" width="100%" />
+<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
+cellspacing="0">
+<tr>
+<td width="33%" align="left" valign="top"><a href="filesystem-structure-links.html"
+accesskey="P">Prev</a></td>
+<td width="34%" align="center" valign="top"><a href="index.html"
+accesskey="H">Home</a></td>
+<td width="33%" align="right" valign="top"><a href="filesystem-structure-nfs.html"
+accesskey="N">Next</a></td>
+</tr>
+
+<tr>
+<td width="33%" align="left" valign="top">Links</td>
+<td width="34%" align="center" valign="top"><a href="filesystem-structure.html"
+accesskey="U">Up</a></td>
+<td width="33%" align="right" valign="top">NFS Mounts</td>
+</tr>
+</table>
+</div>
+</body>
+</html>
+