old-www/LDP/www.debian.org/doc/manuals/debian-tutorial/ch-disks.html

1010 lines
39 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Debian Tutorial (Obsolete Documentation) - Using disks</title>
<link href="index.html" rel="start">
<link href="ch-file_tools.html" rel="prev">
<link href="ch-dpkg.html" rel="next">
<link href="index.html#contents" rel="contents">
<link href="index.html#copyright" rel="copyright">
<link href="ch-about.html" rel="chapter" title="1 About this manual">
<link href="ch-introduction.html" rel="chapter" title="2 Introduction">
<link href="ch-start.html" rel="chapter" title="3 Getting started">
<link href="ch-basics.html" rel="chapter" title="4 The Basics">
<link href="ch-docs.html" rel="chapter" title="5 Reading documentation and getting help">
<link href="ch-shell.html" rel="chapter" title="6 Using the shell">
<link href="ch-files.html" rel="chapter" title="7 More on files">
<link href="ch-editor.html" rel="chapter" title="8 Creating and editing text files">
<link href="ch-custom_shell.html" rel="chapter" title="9 Customizing the shell">
<link href="ch-X.html" rel="chapter" title="10 The X Window System">
<link href="ch-text_tools.html" rel="chapter" title="11 Text tools">
<link href="ch-file_tools.html" rel="chapter" title="12 File tools">
<link href="ch-disks.html" rel="chapter" title="13 Using disks">
<link href="ch-dpkg.html" rel="chapter" title="14 Removing and installing software">
<link href="ch-troubleshooting.html" rel="chapter" title="15 Troubleshooting">
<link href="ch-advanced.html" rel="chapter" title="16 Advanced topics">
<link href="ch-next.html" rel="chapter" title="17 Where to from here?">
<link href="ch-helping.html" rel="chapter" title="18 Contributing to Debian: How can I help?">
<link href="ap-apps_appendix.html" rel="appendix" title="A A brief survey of available applications">
<link href="ap-components_appendix.html" rel="appendix" title="B Summary of GNU/Linux system components">
<link href="ap-booting_appendix.html" rel="appendix" title="C Appendix C: Booting the system">
<link href="ap-misc_appendix.html" rel="appendix" title="D Miscellaneous">
<link href="ch-about.html#s-acknowldgements" rel="section" title="1.1 Acknowledgements">
<link href="ch-introduction.html#s-introduction-debian" rel="section" title="2.1 What is Debian?">
<link href="ch-introduction.html#s-introduction-DFSG" rel="section" title="2.2 What's free software?">
<link href="ch-introduction.html#s-introduction-how" rel="section" title="2.3 How to Read This Book">
<link href="ch-introduction.html#s-introduction-ldp" rel="section" title="2.4 The Linux Documentation Project">
<link href="ch-start.html#s-start-multi" rel="section" title="3.1 A multiuser, multitasking operating system">
<link href="ch-start.html#s-start-login" rel="section" title="3.2 Logging in">
<link href="ch-start.html#s-start-keys" rel="section" title="3.3 Keys">
<link href="ch-start.html#s-start-commandline" rel="section" title="3.4 Command history and editing the command line">
<link href="ch-start.html#s-start-root" rel="section" title="3.5 Logging in as root">
<link href="ch-start.html#s-start-VC" rel="section" title="3.6 Virtual consoles">
<link href="ch-start.html#s-start-shutdown" rel="section" title="3.7 Shutting down">
<link href="ch-basics.html#s-basics-commandline" rel="section" title="4.1 The command line and <samp>man</samp> pages">
<link href="ch-basics.html#s-basics-files" rel="section" title="4.2 Files and Directories">
<link href="ch-basics.html#s-basics-processes" rel="section" title="4.3 Processes">
<link href="ch-basics.html#s-basics-shell" rel="section" title="4.4 The shell">
<link href="ch-basics.html#s-basics-jobs" rel="section" title="4.5 Managing processes with Bash">
<link href="ch-basics.html#s-basics-bash" rel="section" title="4.6 A few Bash features">
<link href="ch-basics.html#s-basics-identity" rel="section" title="4.7 Managing your identity">
<link href="ch-docs.html#s-docs-sources" rel="section" title="5.1 Kinds of documentation">
<link href="ch-docs.html#s-docs-info" rel="section" title="5.2 Using info">
<link href="ch-docs.html#s-docs-textfiles" rel="section" title="5.3 Viewing text files with more and less">
<link href="ch-docs.html#s-docs-howtos" rel="section" title="5.4 HOWTOs">
<link href="ch-docs.html#s-docs-support" rel="section" title="5.5 Getting help from a person">
<link href="ch-docs.html#s-docs-sysinfo" rel="section" title="5.6 Getting information from the system">
<link href="ch-shell.html#s-shell-variables" rel="section" title="6.1 Environment variables">
<link href="ch-shell.html#s-shell-path" rel="section" title="6.2 Where commands live: the <samp>PATH</samp> variable">
<link href="ch-shell.html#s-custom_shell-aliases" rel="section" title="6.3 Aliases and shell functions">
<link href="ch-shell.html#s-shell-io" rel="section" title="6.4 Controlling input and output">
<link href="ch-shell.html#s-shell-modifiers" rel="section" title="6.5 Specifying how and when to run commands">
<link href="ch-shell.html#s-shell-wildcards" rel="section" title="6.6 Filename expansion (&quot;Wildcards&quot;)">
<link href="ch-shell.html#s6.7" rel="section" title="6.7 Interactive/non-interactive">
<link href="ch-files.html#s-files-permissions" rel="section" title="7.1 Permissions">
<link href="ch-files.html#s-files-tour" rel="section" title="7.2 What files are on my system? Where can I put my own files?">
<link href="ch-files.html#s-file-manager" rel="section" title="7.3 Using a filemanager">
<link href="ch-editor.html#s-editor-textfile" rel="section" title="8.1 What's a text file?">
<link href="ch-editor.html#s-editor-editor" rel="section" title="8.2 Text editors">
<link href="ch-editor.html#s-editor-vi" rel="section" title="8.3 Creating and editing a text file with <code>vi</code>">
<link href="ch-custom_shell.html#s-custom_shell-dotfiles" rel="section" title="9.1 .rc files and <samp>ls -a</samp>">
<link href="ch-custom_shell.html#s-custom_shell-etc" rel="section" title="9.2 System-wide vs. user-specific configuration">
<link href="ch-X.html#s-X-starting" rel="section" title="10.1 Starting the X environment">
<link href="ch-X.html#s-X-intro" rel="section" title="10.2 Intro: What is X">
<link href="ch-X.html#s-X-basics" rel="section" title="10.3 Basic X operations">
<link href="ch-X.html#s-X-startup" rel="section" title="10.4 Customizing your X startup">
<link href="ch-text_tools.html#s-text_tools-regexps" rel="section" title="11.1 Regular expressions">
<link href="ch-file_tools.html#s-file_tools-backup" rel="section" title="12.1 Backup tools">
<link href="ch-file_tools.html#s-file_tools-compression" rel="section" title="12.2 File compression with <samp>gzip</samp>">
<link href="ch-file_tools.html#s-file_tools-split" rel="section" title="12.3 Splitting files into smaller pieces">
<link href="ch-file_tools.html#s-file_tools-find" rel="section" title="12.4 Finding files">
<link href="ch-file_tools.html#s-file_tools-file" rel="section" title="12.5 Determining a file's contents">
<link href="ch-disks.html#s-disks-concepts" rel="section" title="13.1 Concepts">
<link href="ch-disks.html#s-disks-mount" rel="section" title="13.2 <samp>mount</samp> and <samp>/etc/fstab</samp>">
<link href="ch-disks.html#s-network-ppp" rel="section" title="13.3 PPP">
<link href="ch-dpkg.html#s-dpkg-dpkg" rel="section" title="14.1 The <code>dpkg</code> package utility">
<link href="ch-dpkg.html#s-dpkg-what" rel="section" title="14.2 What a package maintenance utility does">
<link href="ch-dpkg.html#s-dpkg-apt" rel="section" title="14.3 Apt">
<link href="ch-dpkg.html#s-dpkg-dselect" rel="section" title="14.4 Using dselect.">
<link href="ch-dpkg.html#s-dpkg-commandline" rel="section" title="14.5 Using dpkg manually">
<link href="ch-dpkg.html#s-dpkg-compiling" rel="section" title="14.6 Compiling software yourself">
<link href="ch-dpkg.html#s-dpkg-proprietary" rel="section" title="14.7 Proprietary software not in .deb format">
<link href="ch-troubleshooting.html#s-troubleshooting-frozen" rel="section" title="15.1 Debian is frozen or crashed!">
<link href="ch-troubleshooting.html#s-troubleshooting-termgarbage" rel="section" title="15.2 My terminal isn't behaving properly">
<link href="ch-troubleshooting.html#s-troubleshooting-vi" rel="section" title="15.3 The computer beeps when I press a key, and my screen shows a text file and/or a lot of <samp>~</samp> symbols.">
<link href="ch-advanced.html#s-advanced-scripting" rel="section" title="16.1 Introduction to shell scripting">
<link href="ch-advanced.html#s-advanced-files" rel="section" title="16.2 Advanced files">
<link href="ch-advanced.html#s-advanced-kernel" rel="section" title="16.3 Compiling the kernel">
<link href="ch-advanced.html#s-advanced-security" rel="section" title="16.4 A few words on security">
<link href="ch-advanced.html#s-advanced-programming" rel="section" title="16.5 Programming on Linux">
<link href="ch-next.html#s-next-manuals" rel="section" title="17.1 Other Debian manuals to read">
<link href="ch-next.html#s-next-resources" rel="section" title="17.2 Other resources">
<link href="ch-helping.html#s-helping-bugs" rel="section" title="18.1 Submit bug reports">
<link href="ch-helping.html#s-helping-other" rel="section" title="18.2 Other things">
<link href="ap-apps_appendix.html#s-A_apps-whatever" rel="section" title="A.1 (Subheadings could copy the structure of the menu system)">
<link href="ap-misc_appendix.html#s-unix-history" rel="section" title="D.1 Unix History">
<link href="ap-misc_appendix.html#sD.2" rel="section" title="D.2 GNU/Linux History">
<link href="ap-misc_appendix.html#sD.3" rel="section" title="D.3 The Linux kernel's version numbering">
<link href="ch-introduction.html#s-introduction-debian-os" rel="subsection" title="2.1.1 What's an operating system, and what sort of operating system is Debian?">
<link href="ch-introduction.html#s-introduction-debian-how" rel="subsection" title="2.1.2 Who creates Debian?">
<link href="ch-basics.html#s-basics-commandline-description" rel="subsection" title="4.1.1 Describing the command line">
<link href="ch-basics.html#s-basics-files-intro" rel="subsection" title="4.2.1 Introduction to files">
<link href="ch-basics.html#s-basics-files-using" rel="subsection" title="4.2.2 Using files: a tutorial">
<link href="ch-basics.html#s-basics-bash-completion" rel="subsection" title="4.6.1 Tab Completion">
<link href="ch-docs.html#s-docs-support-posting" rel="subsection" title="5.5.1 Dos and Don'ts of asking a question">
<link href="ch-shell.html#s-shell-variables-parents" rel="subsection" title="6.1.1 Parent and child processes">
<link href="ch-shell.html#s-interactive-shells" rel="subsection" title="6.7.1 Interactive shells">
<link href="ch-files.html#s-files-permissions-groups" rel="subsection" title="7.1.1 File Ownership">
<link href="ch-files.html#s-files-permissions-mode" rel="subsection" title="7.1.2 Mode">
<link href="ch-files.html#s-files-permissions-tutorial" rel="subsection" title="7.1.3 Permissions in practice">
<link href="ch-editor.html#s-editor-vi-creating" rel="subsection" title="8.3.1 Creating a file">
<link href="ch-editor.html#s-editor-vi-editing" rel="subsection" title="8.3.2 Editing an existing file">
<link href="ch-editor.html#s-editor-vi-editing-movement" rel="subsection" title="8.3.2.1 Moving around in a file">
<link href="ch-editor.html#s-editor-vi-editing-deletion" rel="subsection" title="8.3.2.2 Deleting text">
<link href="ch-editor.html#s-editor-vi-editing-moremoving" rel="subsection" title="8.3.2.3 Sophisticated movement">
<link href="ch-editor.html#s-editor-vi-editing-numbers" rel="subsection" title="8.3.2.4 Repeating commands">
<link href="ch-editor.html#s-editor-vi-editing-advanced" rel="subsection" title="8.3.2.5 Advanced reference">
<link href="ch-X.html#s-X-basics-mouse" rel="subsection" title="10.3.1 The mouse">
<link href="ch-X.html#s-X-basics-clients" rel="subsection" title="10.3.2 X clients">
<link href="ch-X.html#s-X-basics-trouble" rel="subsection" title="10.3.3 Troubleshooting">
<link href="ch-X.html#s-X-basics-leaving" rel="subsection" title="10.3.4 Leaving the X environment">
<link href="ch-disks.html#s-disks-mount-mounting" rel="subsection" title="13.2.1 Mounting a filesystem">
<link href="ch-disks.html#s-disks-mount-cdromexample" rel="subsection" title="13.2.2 Example: Mounting a CD-ROM">
<link href="ch-disks.html#s-disks-mount-fstab" rel="subsection" title="13.2.3 <samp>/etc/fstab</samp>: Automating the mount process">
<link href="ch-disks.html#s-disks-mount-removable" rel="subsection" title="13.2.4 Removable disks (floppies, Zip disks, etc.)">
<link href="ch-disks.html#s-network-ppp-introduction" rel="subsection" title="13.3.1 Introduction">
<link href="ch-disks.html#s-network-ppp-preparation" rel="subsection" title="13.3.2 Preparation">
<link href="ch-disks.html#s-network-ppp-wvdial" rel="subsection" title="13.3.3 The Easy Way: <samp>wvdial</samp>">
<link href="ch-disks.html#s-network-ppp-pppd" rel="subsection" title="13.3.4 Doing It Manually">
<link href="ch-dpkg.html#s-apt-config" rel="subsection" title="14.3.1 Configuring Apt">
<link href="ch-dpkg.html#s-apt-usage" rel="subsection" title="14.3.2 Using apt-get.">
<link href="ch-advanced.html#s-advanced-scripting-why" rel="subsection" title="16.1.1 What and why">
<link href="ch-advanced.html#s-advanced-scripting-example" rel="subsection" title="16.1.2 A simple example">
<link href="ch-advanced.html#s-advanced-files-hardlinks" rel="subsection" title="16.2.1 The real nature of files: hard links and inodes">
<link href="ch-advanced.html#s-advanced-files-types" rel="subsection" title="16.2.2 Types of files">
<link href="ch-advanced.html#s-advanced-files-types-symlinks" rel="subsection" title="16.2.2.1 Symbolic links">
<link href="ch-advanced.html#s-files-misc-types-devices" rel="subsection" title="16.2.2.2 Device files">
<link href="ch-advanced.html#s-advanced-files-types-devices-null" rel="subsection" title="16.2.2.2.1 <samp>/dev/null</samp>">
<link href="ch-advanced.html#s-advanced-files-types-pipes" rel="subsection" title="16.2.2.3 Named pipes (FIFOs)">
<link href="ch-advanced.html#s-advanced-files-types-sockets" rel="subsection" title="16.2.2.4 Sockets">
<link href="ch-advanced.html#s-advanced-files-proc" rel="subsection" title="16.2.3 The <samp>proc</samp> filesystem">
<link href="ch-advanced.html#s-advanced-files-permissions" rel="subsection" title="16.2.4 Advanced aspects of file permissions">
<link href="ch-advanced.html#s-advanced-files-permissions-absolute" rel="subsection" title="16.2.4.1 Using numeric arguments with <samp>chmod</samp>">
<link href="ch-advanced.html#s-advanced-files-chattr" rel="subsection" title="16.2.5 chattr">
<link href="ch-advanced.html#s-advanced-files-copying" rel="subsection" title="16.2.6 Large-scale copying">
<link href="ch-advanced.html#s-advanced-files-undocumented" rel="subsection" title="16.2.7 Other concepts not yet covered, but should be">
</head>
<body>
<p><a name="ch-disks"></a></p>
<hr>
<p>
[ <a href="ch-file_tools.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch-about.html">1</a> ]
[ <a href="ch-introduction.html">2</a> ]
[ <a href="ch-start.html">3</a> ]
[ <a href="ch-basics.html">4</a> ]
[ <a href="ch-docs.html">5</a> ]
[ <a href="ch-shell.html">6</a> ]
[ <a href="ch-files.html">7</a> ]
[ <a href="ch-editor.html">8</a> ]
[ <a href="ch-custom_shell.html">9</a> ]
[ <a href="ch-X.html">10</a> ]
[ <a href="ch-text_tools.html">11</a> ]
[ <a href="ch-file_tools.html">12</a> ]
[ 13 ]
[ <a href="ch-dpkg.html">14</a> ]
[ <a href="ch-troubleshooting.html">15</a> ]
[ <a href="ch-advanced.html">16</a> ]
[ <a href="ch-next.html">17</a> ]
[ <a href="ch-helping.html">18</a> ]
[ <a href="ap-apps_appendix.html">A</a> ]
[ <a href="ap-components_appendix.html">B</a> ]
[ <a href="ap-booting_appendix.html">C</a> ]
[ <a href="ap-misc_appendix.html">D</a> ]
[ <a href="ch-dpkg.html">next</a> ]
</p>
<hr>
<h1>
Debian Tutorial (Obsolete Documentation)
<br>Chapter 13 - Using disks
</h1>
<hr>
<h2><a name="s-disks-concepts"></a>13.1 Concepts</h2>
<p>
It's probably a good idea to explain a little theory before discussing the
mechanics of using disks. In particular, the concept of a <em>filesystem</em>.
[<a href="footnotes.html#f17" name="fr17">17</a>] This is confusing, because it
has several meanings.
</p>
<ul>
<li>
<p>
<em>The</em> filesystem refers to the whole directory tree, starting with the
root directory <samp>/</samp>, as described above.
</p>
</li>
</ul>
<ul>
<li>
<p>
A &quot;filesystem&quot; in general means any organization of files and
directories on a particular physical device. &quot;Organization&quot; means
the hierarchical directory structure, and any other information about files one
might want to keep track of: their size, who has permission to change them,
etc. So you might have one filesystem on your hard disk, and another one on
each floppy disk.
</p>
</li>
</ul>
<ul>
<li>
<p>
&quot;Filesystem&quot; is also used to mean a <em>type</em> of filesystem. For
example, MS-DOS and Windows 3.1 organize files in a particular way, with
particular rules: filenames can only have 8 characters, for example, and no
permissions information is stored. Linux calls this the <samp>msdos</samp>
filesystem. Linux also has its own filesystem, called the <samp>ext2</samp>
filesystem (version two of the <samp>ext</samp> filesystem). You'll use the
<samp>ext2</samp> filesystem pretty much all the time, unless you're accessing
files from another operating system or have other special needs.
</p>
</li>
</ul>
<p>
Any physical device you wish to use for storing files must have at least one
filesystem on it. This means a filesystem in the second sense - a hierarchy of
files and directories, along with information about them. Of course, any
filesystem has a type, so the third sense will come into play as well. If you
have more than one filesystem on a single device, each filesystem can have a
different type --- for example, you might have both a DOS partition and a Linux
partition on your hard disk.
</p>
<p>
It's important to distinguish the filesystem from the low-level format of the
disk. In the DOS and Macintosh worlds, the filesystem is called the high-level
format. When you format a disk using one of those operating systems, generally
you both perform a low-level format and create a file system (high-level
format). On GNU and Unix systems, one generally says simply &quot;format&quot;
to mean low-level format, and &quot;making a filesystem&quot; to mean
high-level format.
</p>
<p>
Formatting has to do with the particulars of the physical device, such as the
exact physical location of your data on a floppy disk (on the edge or near the
center of the disk for example). The filesystem is the level of organization
you have to worry about --- names of directories and files, their sizes, etc.
</p>
<hr>
<h2><a name="s-disks-mount"></a>13.2 <samp>mount</samp> and <samp>/etc/fstab</samp></h2>
<p>
This section describes how to mount a floppy or Zip disk, the <samp>/dev</samp>
directory, and distributing the directory tree over multiple physical devices
or partitions.
</p>
<hr>
<h3><a name="s-disks-mount-mounting"></a>13.2.1 Mounting a filesystem</h3>
<p>
On a GNU/Linux system there's no necessary correspondence between directories
and physical devices, as there is in Windows where each drive has its own
directory tree beginning with a letter (such as <samp>C:\</samp>).
</p>
<p>
Instead, each physical device such as a hard disk or floppy disk has one or
more filesystems on it. In order to make a filesystem accessible, it's
assigned to a particular directory in another filesystem. To avoid
circularity, the root filesystem (which contains the root directory
<samp>/</samp>) is not contained by any other filesystem --- you have access to
it automatically when you boot Debian.
</p>
<p>
A directory in one filesystem which contains another filesystem is known as a
<em>mount point</em>. A mount point is a directory in a first filesystem on
one device (such as your hard disk) which &quot;contains&quot; a second
filesystem, perhaps on another device (such as a floppy disk). To access a
filesystem, you must mount it at some mount point.
</p>
<p>
So, for example, you might mount a CD at the mount point <samp>/cdrom</samp>.
This means that if you look in the directory <samp>/cdrom</samp>, you'll see
the contents of the CD. The <samp>/cdrom</samp> directory itself is actually
on your hard disk. For all practical purposes the contents of the CD become a
part of the root filesystem, and when typing commands and using programs it
doesn't make any difference what the actual physical location of the files is.
You could have created a directory on your hard disk called
<samp>/cdrom</samp>, and put some files in it, and everything would behave in
exactly the same way. Once you mount a filesystem, there's no need to pay any
attention to physical devices.
</p>
<p>
However, before mounting a filesystem, or to actually create a filesystem on a
disk that doesn't have one yet, it's necessary to refer to the devices
themselves. All devices have names, and these are located in the
<samp>/dev</samp> directory. If you type <samp>ls /dev</samp> now, you'll see
a pretty lengthy list of every possible device you could have on your Debian
system.
</p>
<p>
Possible devices include: [<a href="footnotes.html#f18" name="fr18">18</a>]
</p>
<ul>
<li>
<p>
<samp>/dev/hda</samp> is IDE drive A. In general, this will be a hard drive.
IDE refers to the type of drive - if you don't know what it means, you probably
have this kind of drive, because it's the most common. Your DOS/Windows
<samp>C:\</samp> partition is likely to be on this drive.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>/dev/hdb</samp> is IDE drive B, as you might guess. This could be a
second hard drive, or perhaps a CD-ROM drive. Drives A and B are the first and
second (master and slave) drives on the primary IDE controller. Drives C and D
are the first and second drives on the secondary controller.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>/dev/hda1</samp> is the first <em>partition</em> of IDE drive A, usually
called <samp>C:\</samp> on a DOS or Windows system. Notice that different
drives are lettered, while specific partitions of those drives are numbered as
well.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>/dev/sda</samp> is SCSI disk A. SCSI is like IDE, only if you don't know
what it is you probably <em>don't</em> have one of these drives. They're not
very common in home Intel PC's, though they're often used in servers and
Macintoshes often have SCSI disks. [<a href="footnotes.html#f19"
name="fr19">19</a>]
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>/dev/fd0</samp> is the first floppy drive, generally <samp>A:\</samp>
under DOS. Since floppy disks don't have partitions, they only have numbers,
rather than the letter-number scheme used for hard drives. However, for floppy
drives the numbers refer to the drive, and for hard drives the numbers refer to
the partitions.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>/dev/ttyS0</samp> is the first of your serial ports (<samp>COM1:</samp>
under DOS). <samp>/dev</samp> contains the names of many devices, not just
disk drives.
</p>
</li>
</ul>
<p>
To mount a filesystem, we want to tell Linux to associate whatever filesystem
it finds on a particular device with a particular mount point. In the process,
we might have to tell Linux what kind of filesystem to look for.
</p>
<hr>
<h3><a name="s-disks-mount-cdromexample"></a>13.2.2 Example: Mounting a CD-ROM</h3>
<p>
As a simple demonstration, we'll go through mounting a CD-ROM, such as the one
you may have used to install Debian. You'll need to be root to do this, so be
careful; whenever you're root you have the power to mess up the whole system,
rather than just your own files. Also, these commands assume there's a CD in
your drive; you should put one in the drive now.
</p>
<ol type="1" start="1" >
<li>
<p>
<samp>su</samp>
</p>
<p>
If you haven't already, you need to either log in as root or gain root
privileges with the <samp>su</samp> (super user) command. If you use
<samp>su</samp>, enter the root password when prompted.
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
<samp>ls /cdrom</samp>
</p>
<p>
See what's in the <samp>/cdrom</samp> directory before you start. If you don't
have a <samp>/cdrom</samp> directory, you may have to make one using
<samp>mkdir /cdrom</samp>.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
<samp>mount</samp>
</p>
<p>
Typing simply <samp>mount</samp> with no arguments lists the currently mounted
filesystems.
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
<samp>mount -t iso9660 <var>CD device</var> /cdrom</samp>
</p>
<p>
For this command, you should substitute the name of your CD-ROM device for
<samp><var>CD device</var></samp> in the above command line. If you aren't
sure, <samp>/dev/cdrom</samp> is a good guess since the install process should
have created this symbolic link on the system. If that fails, try the
different IDE devices: <samp>/dev/hdc</samp>, etc. You should see a message
like:
</p>
<pre>
mount: block device /dev/hdc is write-protected, mounting read-only
</pre>
<p>
The <samp>-t</samp> option specifies the type of the filesystem, in this case
<samp>iso9660</samp>. Most CDs are <samp>iso9660</samp>. The next argument is
the name of the device to mount, and the final argument is the mount point.
There are many other arguments to <samp>mount</samp>; see the manual page for
details.
</p>
<p>
Once a CD is mounted, you may find that your drive tray will not open. You
must unmount the CD before removing it.
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
<samp>ls /cdrom</samp>
</p>
<p>
Confirm that <samp>/cdrom</samp> now contains whatever is on the CD in your
drive.
</p>
</li>
</ol>
<ol type="1" start="6" >
<li>
<p>
<samp>mount</samp>
</p>
<p>
Look at the list of filesystems again, noticing that your CD drive is now
mounted.
</p>
</li>
</ol>
<ol type="1" start="7" >
<li>
<p>
<samp>umount /cdrom</samp>
</p>
<p>
This unmounts the CD. It's now safe to remove the CD from the drive. Notice
that the command is <samp>umount</samp> with no &quot;n&quot;, even though it's
used to u<em>n</em>mount the filesystem.
</p>
</li>
</ol>
<ol type="1" start="8" >
<li>
<p>
<samp>exit</samp>
</p>
<p>
Don't leave yourself logged on as root. Log out immediately, just to be safe.
</p>
</li>
</ol>
<hr>
<h3><a name="s-disks-mount-fstab"></a>13.2.3 <samp>/etc/fstab</samp>: Automating the mount process</h3>
<p>
The file <samp>/etc/fstab</samp> (it stands for &quot;file system table&quot;)
contains descriptions of filesystems that you mount often. These filesystems
can then be mounted with a shorter command, such as <samp>mount /cdrom</samp>.
You can also configure filesystems to mount automatically when the system
boots. You'll probably want to mount all of your hard disk filesystems when
you boot.
</p>
<p>
Look at this file now, by typing <samp>more /etc/fstab</samp>. It will have
two or more entries that were configured automatically when you installed the
system. It probably looks something like this:
</p>
<pre>
# /etc/fstab: static file system information.
#
# &lt;file system&gt; &lt;mount point&gt; &lt;type&gt; &lt;options&gt; &lt;dump &gt; &lt;pass&gt;
/dev/hda1 / ext2 defaults 0 1
/dev/hda3 none swap sw 0 0
proc /proc proc defaults 0 0
/dev/hda5 /tmp ext2 defaults 0 2
/dev/hda6 /home ext2 defaults 0 2
/dev/hda7 /usr ext2 defaults 0 2
/dev/hdc /cdrom iso9660 ro,noauto 0 0
/dev/fd0 /floppy auto noauto,sync 0 0
</pre>
<p>
The first column lists the device the filesystem resides on. The second lists
the mount point, the third the filesystem type. The line beginning by
<samp>proc</samp> is a special filesystem . Notice that the swap partition
(<samp>/dev/hda3</samp> in the example) has no mount point, so the mount point
column contains <samp>none</samp>.
</p>
<p>
The last three columns may require some explanation.
</p>
<p>
The fifth column is used by the <samp>dump</samp> utility to decide when to
back up the filesystem. In most cases you can put <samp>0</samp> here.
</p>
<p>
The sixth column is used by <samp>fsck</samp> to decide in what order to check
filesystems when you boot the system. The root filesystem should have a
<samp>1</samp> in this field, filesystems which don't need to be checked (such
as the swap partition) should have a <samp>0</samp>, and all other filesystems
should have a <samp>2</samp>. It's worth noting that the swap partition isn't
exactly a filesystem in the sence that it does not contain files and
directories, but is just used by the Linux kernel as secondary memory.
However, for historical reasons, the swap partitions are still listed in the
same file than the filesystems.
</p>
<p>
Column four contains one or more options to use when mounting the filesystem.
Here's a brief summary (some of these probably won't make much sense yet ---
they're here for future reference):
</p>
<dl>
<dt><samp>async</samp> and <samp>sync</samp></dt>
<dd>
<p>
Do I/O synchronously or asynchronously. Synchronous I/O writes changes to
files immediately, while asynchronous I/O may keep data in buffers and write it
later, for efficiency reasons.
</p>
</dd>
</dl>
<dl>
<dt><samp>ro</samp> and <samp>rw</samp></dt>
<dd>
<p>
Mount the filesystem read-only or read-write. If you don't need to make any
changes to the filesystem, it's a good idea to mount it read-only so you don't
accidentally mess something up. Also, read-only devices (such as CD-ROM drives
and floppy disks with write protection tabs) should be mounted read-only.
</p>
</dd>
</dl>
<dl>
<dt><samp>auto</samp> and <samp>noauto</samp></dt>
<dd>
<p>
When the system boots, or whenever you type <samp>mount -a</samp>,
<samp>mount</samp> tries to mount all the filesystems listed in
<samp>/etc/fstab</samp>. If you don't want it to automatically mount a
filesystem, you should use the <samp>noauto</samp> option. It's probably a
good idea to use <samp>noauto</samp> with removable media such as floppy disks,
because there may or may not be a disk in the drive. You'll want to mount
these filesystems manually after you put in a disk.
</p>
</dd>
</dl>
<dl>
<dt><samp>dev</samp> and <samp>nodev</samp></dt>
<dd>
<p>
Use or ignore device files on this filesystem. You might use
<samp>nodev</samp> if you mount the root directory of another system on your
system --- you don't want your system to try to use the devices on the other
machine.
</p>
</dd>
</dl>
<dl>
<dt><samp>user</samp> and <samp>nouser</samp></dt>
<dd>
<p>
Permit or forbid ordinary users to mount the filesystem. <samp>nouser</samp>
means that only root can mount the filesystem. This is the normal arrangement.
You might use the <samp>user</samp> option to access the floppy drive without
having to be root.
</p>
</dd>
</dl>
<dl>
<dt><samp>exec</samp> and <samp>noexec</samp></dt>
<dd>
<p>
Allow or do not allow the execution of files on this filesystem. Probably you
won't need these options.
</p>
</dd>
</dl>
<dl>
<dt><samp>suid</samp> and <samp>nosuid</samp></dt>
<dd>
<p>
Allow or do not allow the suid bit to take effect. Probably you won't need
these options.
</p>
</dd>
</dl>
<dl>
<dt><samp>defaults</samp></dt>
<dd>
<p>
Equivalent to: <samp>rw</samp>, <samp>dev</samp>, <samp>suid</samp>,
<samp>exec</samp>, <samp>auto</samp>, <samp>nouser</samp>, <samp>async</samp>.
You can specify <samp>defaults</samp> followed by other options to override
specific aspects of <samp>defaults</samp>.
</p>
</dd>
</dl>
<hr>
<h3><a name="s-disks-mount-removable"></a>13.2.4 Removable disks (floppies, Zip disks, etc.)</h3>
<p>
Add the following lines to your <samp>/etc/fstab</samp> file:
</p>
<pre>
/dev/sda1 /mnt/zip ext2 noauto,user 0 0
/dev/sda4 /mnt/dos msdos noauto,user 0 0
</pre>
<p>
From then on, you'll be able to mount the DOS formated Zip disks with the
command <samp>mount /mnt/dos</samp>, and Linux formated Zip disks with the
command <samp>mount /mnt/zip</samp>. [<a href="footnotes.html#f20"
name="fr20">20</a>]
</p>
<hr>
<h2><a name="s-network-ppp"></a>13.3 PPP</h2>
<hr>
<h3><a name="s-network-ppp-introduction"></a>13.3.1 Introduction</h3>
<p>
If you connect to the internet over a phone line, you'll want to use PPP
(Point-To-Point Protocol). This is the standard connection method offered by
ISPs (Internet Service Providers). In addition to using PPP to dial your ISP,
you can have your computer listen for incoming connections --- this lets you
dial your computer from a remote location.
</p>
<p>
This section is a quick-start no-frills guide to setting up PPP on Debian. If
it turns out that you need more details, see the excellent <code><a
href="http://metalab.unc.edu/LDP/HOWTO/PPP-HOWTO.html">PPP HOWTO</a></code>
from the Linux Documentation Project. The HOWTO goes into much more detail if
you're interested or have unique needs.
</p>
<hr>
<h3><a name="s-network-ppp-preparation"></a>13.3.2 Preparation</h3>
<p>
Configuring PPP on GNU/Linux is straightforward once you have all the
information you'll need. Debian makes things even easier with its simple
configuration tools.
</p>
<p>
Before you start, be sure you have all the information provided by your ISP.
This might include:
</p>
<ul>
<li>
<p>
Username or login
</p>
</li>
</ul>
<ul>
<li>
<p>
Password
</p>
</li>
</ul>
<ul>
<li>
<p>
Your static IP (Internet Protocol) address, if any (these look like
<samp>209.81.8.242</samp>)
</p>
</li>
</ul>
<ul>
<li>
<p>
Bitmask (this will look something like <samp>255.255.255.248</samp>)
</p>
</li>
</ul>
<ul>
<li>
<p>
The IP addresses of your ISPs name server (or DNS).
</p>
</li>
</ul>
<ul>
<li>
<p>
Any special login procedure required by the ISP.
</p>
</li>
</ul>
<p>
Next, you'll want to investigate your hardware setup: whether your modem works
with GNU/Linux, and which serial port it's connected to.
</p>
<p>
There's a simple rule which determines whether your modem will work. If it's a
&quot;WinModem&quot; or &quot;host-based modem&quot;, it won't work. These
modems are cheap because they have very little functionality, and require the
computer to make up for their shortcomings. Unfortunately, this means they are
complex to program, and manufacturers generally do not make the specifications
available for developers.
</p>
<p>
If you have a modem with its own on-board circuitry, you should have no trouble
at all.
</p>
<p>
On GNU/Linux systems, the serial ports are referred to as
<samp>/dev/ttyS0</samp>, <samp>/dev/ttyS1</samp>, and so on. Your modem is
almost certainly connected to either port 0 or port 1, equivalent to
<samp>COM1:</samp> and <samp>COM2:</samp> under Windows. If you don't know
which your modem is connected to, <samp>wvdialconf</samp> can try to detect it
(see below); otherwise just try both and see which works.
</p>
<p>
If you want to talk to your modem or dial your ISP without using PPP, you can
use the <samp>minicom</samp> program. You may need to install the minicom
package before the program is available.
</p>
<hr>
<h3><a name="s-network-ppp-wvdial"></a>13.3.3 The Easy Way: <samp>wvdial</samp></h3>
<p>
The simplest way to get PPP running is with the <samp>wvdial</samp> program.
It makes some reasonable guesses and tries to set things up for you. If it
works, you're in luck. If it guesses wrong, you'll have to do things manually.
</p>
<p>
Be sure you have the following packages installed:
</p>
<ul>
<li>
<p>
<samp>ppp</samp>
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>ppp-pam</samp>
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>wvdial</samp>
</p>
</li>
</ul>
<p>
When you install the <samp>wvdial</samp> package, you may be given the
opportunity to configure it. Otherwise, to set up <samp>wvdial</samp>, follow
these simple steps:
</p>
<ol type="1" start="1" >
<li>
<p>
Login as root, using <samp>su</samp> as described in an earlier chapter
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
<samp>touch /etc/wvdial.conf</samp>
</p>
<p>
<samp>touch</samp> will create an empty file if the file doesn't exist --- the
configuration program requires an existing file.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
<samp>wvdialconf /etc/wvdial.conf</samp>
</p>
<p>
This means you're creating a configuration file, <samp>/etc/wvdial.conf</samp>
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
Answer any questions that appear on the screen. <samp>wvdialconf</samp> will
also scan for your modem and tell you which serial port it's on; you may want
to make a note of this for future reference.
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
<samp>/etc/wvdial.conf</samp> should look something like this now:
</p>
<pre>
[Dialer Defaults]
Modem = /dev/ttyS1
Baud = 115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 S11=55 +FCLASS=0
; Phone = [Target Phone Number]
; Username = [Your Login Name]
; Password = [Your Password]
</pre>
<p>
Just replace the information in brackets with the proper information and remove
the semicolons from the beginning of those lines and you're done! Here is what
a completed <samp>wvdial.conf</samp> file should look like:
</p>
<pre>
[Dialer Defaults]
Modem = /dev/ttyS1
Baud = 115200
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 S11=55 +FCLASS=0
Phone = 5551212
Username = beavis
Password = password
</pre>
</li>
</ol>
<p>
Now that <samp>wvdial.conf</samp> is set up, to connect to your ISP just type
<samp>wvdial</samp>. If it doesn't work, you'll probably have to delve into
manual PPP configuration.
</p>
<hr>
<h3><a name="s-network-ppp-pppd"></a>13.3.4 Doing It Manually</h3>
<p>
This still isn't all that difficult, though it's slightly harder than
<samp>wvdial</samp>. The quick-and-easy summary: type <samp>pppconfig</samp>
as root, answer the questions, then type <samp>pon</samp> to log on, and
<samp>poff</samp> to log off. We'll go into a little more detail though.
</p>
<hr>
<p>
[ <a href="ch-file_tools.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch-about.html">1</a> ]
[ <a href="ch-introduction.html">2</a> ]
[ <a href="ch-start.html">3</a> ]
[ <a href="ch-basics.html">4</a> ]
[ <a href="ch-docs.html">5</a> ]
[ <a href="ch-shell.html">6</a> ]
[ <a href="ch-files.html">7</a> ]
[ <a href="ch-editor.html">8</a> ]
[ <a href="ch-custom_shell.html">9</a> ]
[ <a href="ch-X.html">10</a> ]
[ <a href="ch-text_tools.html">11</a> ]
[ <a href="ch-file_tools.html">12</a> ]
[ 13 ]
[ <a href="ch-dpkg.html">14</a> ]
[ <a href="ch-troubleshooting.html">15</a> ]
[ <a href="ch-advanced.html">16</a> ]
[ <a href="ch-next.html">17</a> ]
[ <a href="ch-helping.html">18</a> ]
[ <a href="ap-apps_appendix.html">A</a> ]
[ <a href="ap-components_appendix.html">B</a> ]
[ <a href="ap-booting_appendix.html">C</a> ]
[ <a href="ap-misc_appendix.html">D</a> ]
[ <a href="ch-dpkg.html">next</a> ]
</p>
<hr>
<p>
Debian Tutorial (Obsolete Documentation)
</p>
<address>
29 Dezember 2009<br>
<br>
Havoc Pennington <code><a href="mailto:hp@debian.org">hp@debian.org</a></code><br>
<br>
</address>
<hr>
</body>
</html>