old-www/LDP/GNU-Linux-Tools-Summary/html/mounting-and-unmounting.html

488 lines
7.8 KiB
HTML
Raw Permalink Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Mounting and Unmounting (Floppy/CDROM/Hard-drive Partitions)</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="GNU/Linux Command-Line Tools Summary"
HREF="index.html"><LINK
REL="UP"
TITLE="Controlling the system"
HREF="controlling-the-system.html"><LINK
REL="PREVIOUS"
TITLE="Controlling the system"
HREF="controlling-the-system.html"><LINK
REL="NEXT"
TITLE="Shutting Down/Rebooting the System"
HREF="shutting-down.html"></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"
>GNU/Linux Command-Line Tools Summary</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="controlling-the-system.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 9. Controlling the system</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="shutting-down.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="MOUNTING-AND-UNMOUNTING"
></A
>9.1. Mounting and Unmounting (Floppy/CDROM/Hard-drive Partitions)</H1
><DIV
CLASS="TIP"
><P
></P
><TABLE
CLASS="TIP"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/tip.gif"
HSPACE="5"
ALT="Tip"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Allowing Users to mount partitions</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>By default a <SPAN
CLASS="PRODUCTNAME"
>UNIX</SPAN
> system will allow normal users to unmount partitions. However unless given permission by the superuser, users will not be allowed to mount partitions. </P
><P
>The commands listed below will not work for normal users unless users have permission to mount that device.</P
><P
>If your particular distribution is setup not to allow users to mount partitions its not very hard to change this, simply edit the <EM
>/etc/fstab</EM
> file (as root) and:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>Replace the word "defaults" with "user" or</PRE
></FONT
></TD
></TR
></TABLE
>
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>Add "user" to the end of the options list for the particular partition(s).</PRE
></FONT
></TD
></TR
></TABLE
></P
></TD
></TR
></TABLE
></DIV
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>mount</DT
><DD
><P
>Mount a device. Attach the device to the file-system hierarchy (the tree ( / )). This needs to be done so you can access the drive (see below, <A
HREF="mounting-and-unmounting.html"
>Section 9.1</A
> for an example).</P
></DD
><DT
>umount</DT
><DD
><P
>'Unmount' a device. The command <EM
>umount</EM
> (no 'n') unmount's a device. It removes it from the file-system hierarchy (the tree ( / )). This needs to be done before you remove a floppy/CDROM or any other removable device (see below, <A
HREF="mounting-and-unmounting.html"
>Section 9.1</A
> for an example).</P
></DD
><DT
>smbmount<EFBFBD>//wincomp/c<>/mnt/win</DT
><DD
><P
>Where &#8220;win&#8221; would be the place you want it mounted and &#8220;wincomp&#8221; is the IP address or name of your windows computer.</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="90%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Please note</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Using ping/smbmount/ssh or other <SPAN
CLASS="PRODUCTNAME"
>UNIX</SPAN
> system programs with a computer name rather than IP address will only work if you have the computer listed in your /etc/hosts file. Here is an example:</P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>192.168.1.100 new </PRE
></FONT
></TD
></TR
></TABLE
> This line says that their is a computer called &#8220;new&#8221; with IP address 192.168.1.100. Now that it exists in the /etc/hosts file I don't have to type the IP address anymore, just the name &#8220;new&#8221;.</P
></TD
></TR
></TABLE
></DIV
><P
><EM
>smbmount</EM
> is a tool from the samba package, it can mount a remote windows file-system onto your current computer.</P
><P
>Un-mounting uses the same syntax as 'umount', as listed above, or you may like to use:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>smbumount /mountpoint</PRE
></FONT
></TD
></TR
></TABLE
><P
>Here are some more examples of how to mount a file-system:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>mount -t ext2 /dev/fd0 /mnt/floppy <A
NAME="VFAT"
><IMG
SRC="../images/callouts/1.gif"
HSPACE="0"
VSPACE="0"
BORDER="0"
ALT="(1)"></A
>
mount -t iso9660 /dev/hdb /mnt/cdrom <A
NAME="CDROM"
><IMG
SRC="../images/callouts/2.gif"
HSPACE="0"
VSPACE="0"
BORDER="0"
ALT="(2)"></A
>
mount -t iso /tmp/image_file /mnt/iso_file/ -o loop <A
NAME="ISO"
><IMG
SRC="../images/callouts/3.gif"
HSPACE="0"
VSPACE="0"
BORDER="0"
ALT="(3)"></A
></PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="CALLOUTLIST"
><DL
COMPACT="COMPACT"
><DT
><A
HREF="mounting-and-unmounting.html#VFAT"
><IMG
SRC="../images/callouts/1.gif"
HSPACE="0"
VSPACE="0"
BORDER="0"
ALT="(1)"></A
></DT
><DD
> The windows filesystem is known as vfat (standard on <SPAN
CLASS="PRODUCTNAME"
>Windows</SPAN
> 9x) or NFTS (standard on <SPAN
CLASS="PRODUCTNAME"
>Windows</SPAN
> 2000 and XP).
</DD
><DT
><A
HREF="mounting-and-unmounting.html#CDROM"
><IMG
SRC="../images/callouts/2.gif"
HSPACE="0"
VSPACE="0"
BORDER="0"
ALT="(2)"></A
></DT
><DD
> for CDROM's
</DD
><DT
><A
HREF="mounting-and-unmounting.html#ISO"
><IMG
SRC="../images/callouts/3.gif"
HSPACE="0"
VSPACE="0"
BORDER="0"
ALT="(3)"></A
></DT
><DD
> This will mount an image file (usually a CD image file) so you can view/change the files (it will appear to be like any other device).
</DD
></DL
></DIV
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="90%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>The -t option</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>On any system running a newer version of the <SPAN
CLASS="PRODUCTNAME"
>Linux</SPAN
> kernel the <EM
>-t</EM
> option is not always necessary and can be left out.</P
></TD
></TR
></TABLE
></DIV
><P
></P
><P
>Examples of how to unmount a file-system (necessary before you eject/remove disk):</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>umount /mount_point</PRE
></FONT
></TD
></TR
></TABLE
><P
>An example unmount point could be &#8220;/mnt/floppy&#8221; or &#8220;/mnt/cdrom&#8221;</P
></DD
></DL
></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="controlling-the-system.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="shutting-down.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Controlling the system</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="controlling-the-system.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Shutting Down/Rebooting the System</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>