📄 linux-mount.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><TITLE>Josh's Linux Guide - Accessing Your Floppy Drive, CD-ROM Drive, and Other Partitions</TITLE> <META NAME="Author" CONTENT="Joshua Go"> <META NAME="Description" CONTENT="How to access your other filesystems and storage mediums under Linux."> <META NAME="keywords" CONTENT="Red Hat, beginners, Linux, help, #LinuxHelp, #Linux, Joshua, Go, operating, system, Josh, mount, file, system, filesystem"></HEAD><LINK REL="stylesheet" TYPE="text/css" HREF="default.css"><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#7F007F"><H2><A NAME="0">Accessing Your Floppy Drive, CD-ROM Drive, and Other Partitions</A></H2><FONT SIZE="-1"><B>Last updated: July 18, 1998</B></FONT><BR><FONT SIZE="-1"><B>Development stage: Beta</B></FONT><P>The process of "mounting" is a means of accessing other typesof filesystems. That means with this, you can use this to read and writeto files from media such as floppies, CD-ROMs, and other partitions ofyour hard drive. Linux uses <TT>/dev</TT> entries to access this, alongwith the <B><TT>mount</TT></B> command. To access your floppy drive, typethis:</P><PRE>mount /dev/fd0 /mnt/floppy</PRE><P>You'll have to create the directory <TT>/mnt/floppy</TT> if it doesn'talready exist. Linux "attaches" the contents to the mount point,otherwise known as the directory <TT>/mnt/floppy/</TT> here. In place of<TT>/mnt/floppy</TT> you can specify any other empty directory.</P><P>The equivalent of typing <TT>a:</TT> in DOS to get into the floppy'sdirectory is typing <B><TT>cd /mnt/floppy</TT></B>. Since it's now part ofyour filesystem, you just change directories.</P><P>You usually have to be the root user to mount and unmount. According to<A HREF="mailto:kng@HK.Super.NET">Kevin Ng</A> it's possible to be anormal user and access devices such as a floppy. He said he modified his<TT>/etc/fstab</TT> file and added the 'user' option, and to consult themount(1) manpage (type 'man mount') for details (of course, manpages mightbe a little hard to understand while you're starting out with Linux, butif you can handle them, by all means read them).</P><H3><A NAME="1">CD-ROM Drive</A></H3><P>Mounting your CD-ROM drive depends on how the drive is set up. Someuncommon CD-ROM drives might not be supported by Linux, but let's just sayyou have a standard drive. You might have to try all of the following:</P><PRE>mount /dev/hdb /mnt/cdrommount /dev/hdc /mnt/cdrommount /dev/hdd /mnt/cdrom</PRE><P>The <TT>hd*</TT> entries might go on, but chances are that it's withinthis range right here. If you're successful, Linux won't spit out anerror; if you're not, it'll say no such device or something like that. Just use the <TT>cd</TT> command to move to the directory you mounted theCD-ROM's contents to (this goes for the floppy drive, too). Thesubdirectories of the CD will be subdirectories in the mount pointdirectory. (Again, this goes for the floppy drive, too).</P><H3><A NAME="2">Other Partitions on Your Hard Drive</A></H3><P>If you have multiple partitions on your hard drive and want to copyfiles back and forth without rebooting, use the <TT>mount</TT> commandalso. You'll have to know which partition your other operating systemrests on, and it is <TT>hda*</TT> in your <TT>/dev/</TT> directory. If youhave Windows 95 or MS-DOS/Win 3.1 running on your first partition, theentry will be <TT>/dev/hda1</TT>. So, you have to type this:</P><PRE>mount /dev/hda1 /mnt/hd/</PRE><P>Well, okay. I'm making this look too much like my computer. Here's thebasic command:</P><PRE>mount /dev/hda* /mnt/hd</PRE><P>This time, you might have to create a directory in <TT>/mnt/</TT> to dothat... try <B><TT>mkdir /mnt/hd</TT></B> as root.</P><P>Again, <TT>/mnt/hd</TT> is the mount point/mount directory (that'swhere you're viewing/reading/writing the floppy or separate partition),and <TT>/dev/hda*</TT> is the device you are going to access. The<TT>*</TT> represents which partition you are going to access through themounting process. The '*' is a whole number, usually from 1 through 4. Youmight also want to change the part after 'hd' to some other letter ifyou're going to mount another partition on your hard drive.</P><H3><A NAME="3">Unmounting</A></H3><P>Unmounting is pretty easy. Basically, this is what you should do.</P><PRE>umount /mnt/hd/</PRE><P><A HREF="mailto:snorthcutt@planetc.com">Scott Northcutt</A> wrote in tosay that when using the <B><TT>umount</TT></B> command, you should be in adirectory other than where the files are mounted. For example, if you havea CD-ROM mounted on <TT>/mnt/cdrom</TT>, you should use <B><TT>cd/directory/somewhere/else</TT></B> to get to another directory, and thenunmount. If you don't do this, Linux will complain that the device isbusy.</P><P>You can also use, in place of <TT>/mnt/hd</TT>, the device that you'retrying to unmount, such as <TT>/dev/hda2</TT>. In the example,<TT>/mnt/hd</TT> is the directory you mounted to, and you change that withwhatever directory you created or used to mount the partition, floppy, orCD.</P><H3><A NAME="4">Suggestions</A></H3><P>Basically, you should use <B><TT>mount</TT></B> to access anything froma floppy to a Zip disk. It's the only tool that I know of to easily readand write to other partitions.</P><P>The file <TT>/etc/fstab</TT> includes information on which devices tomount automatically at startup.</P><PRE>Device names:The first (master) drive on the first Eide interface is /dev/hdaThe second (aka slave) drive on the first Eide interface is /dev/hdbThe first (master) drive on the second Eide interface is /dev/hdcThe second (aka slave) drive on the second Eide interface is /dev/hddSCSI drives are an altogether different thing. They are /dev/sda and soon.From this most people should be able to determine which device names touse. Mounting dos partitions: The mount command needs a parameter to access vfat (long file names)So I mount like this: mount -t vfat /dev/hda1 /msdosAlso, mounting CD's should theoretically be: mount -t iso9660 /dev/hdd /mnt/cdromHowever, since iso9660 is default, this should not be necessary."man mount" is a good way to learn more.Mans Axel Nilsson</PRE><P>And about that VFAT thing, you have to have VFAT support <AHREF="linux-kernel.html">compiled into your kernel</A> for it to work withWindows 95's long filenames.</P><HR><P><B><FONT SIZE="-1">Copyright © 1997-1999 <AHREF="mailto:jgo@local.net">Joshua Go (jgo@local.net)</A>. Allrights reserved. Permission to use, distribute, and copy this document ishereby granted. You may modify this document as long as credit to me isgiven.</FONT></B></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -