old-www/HOWTO/Flash-Memory-HOWTO/verifications.html

586 lines
9.1 KiB
HTML

<HTML
><HEAD
><TITLE
>Basic verifications</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="USB Flash Memory HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE=" Some basic concepts"
HREF="basics.html"><LINK
REL="NEXT"
TITLE=" Setting up an Ext2 filesystem"
HREF="ext2.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"
>USB Flash Memory HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="basics.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="ext2.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="verifications"
></A
>7. Basic verifications</H1
><DIV
CLASS="important"
><P
></P
><TABLE
CLASS="important"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/important.gif"
HSPACE="5"
ALT="Important"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; In order to make sure that the device you look at and write on is
the one intended, it is best to remove similar devices from
the USB-bus before starting these procedures.
</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="quick"
></A
>7.1. A quick check</H2
><P
>&#13; It is possible that your system is already set up for handling a
USB-flash memory device. To check this, simply issue the command
<TT
CLASS="prompt"
>$ </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>mount</B
></B
></TT
> from an X-terminal. If something like
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; none on /proc/bus/usb type usbfs (rw)
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13; appears among the output, you are ready to go to
<A
HREF="verifications.html#tests"
>Section 7.4</A
> and proceed from there. It may be
virtuous, however, to glance through the intervening sections.
If the test is unsuccessful, all is not lost. Please read on.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="proc-probe"
></A
>7.2. Probing the /proc filesystem</H2
><P
>&#13; A few things in the <TT
CLASS="filename"
> /proc</TT
>
directory can be checked so see if the kernel options have been
properly included or the appropriate modules properly inserted. As
a first check, see if the directory <TT
CLASS="filename"
>/proc/bus/usb</TT
> exists. If it does,
your kernel supports the USB-subsystem correctly. If this is not
the case the kernel has to be re-compiled with appropriate USB
support (see <A
HREF="hardware.html#usb"
>Section 5.2.3</A
>) or the kernel has to be
updated. Next, check if the directory <TT
CLASS="filename"
>/proc/scsi</TT
> exists. If it does, you're
well-away. If it doesn't, SCSI support has not been compiled into
your kernel (see <A
HREF="hardware.html#scsi"
>Section 5.2.1</A
>).
</P
><P
>&#13; In <TT
CLASS="filename"
> /proc</TT
> there should be
provision for a mount point for the USB filesystem. That point is
<TT
CLASS="filename"
> /proc/bus/usb</TT
>. If it
exists, the kernel is correctly set up.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="mounting"
></A
>7.3. Mounting the USB filesystem</H2
><P
>&#13; If the verifications of the previous sections were positive, the
next step is to mount the USB filesystem. This is issued from root
as follows:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; <TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>mount</B
> -t usbfs none /proc/bus/usb </B
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; In older kernel versions the mount command above may have to
be changed by replacing <TT
CLASS="parameter"
><I
>usbfs</I
></TT
> with
<TT
CLASS="parameter"
><I
>usbdevfs</I
></TT
>. In Linux-2.4.20 both forms work.
</P
></TD
></TR
></TABLE
></DIV
><P
>&#13; If there are no complaints, do some more tests. The first is the
quick test (<A
HREF="verifications.html#quick"
>Section 7.1</A
>). A deeper probe would be to
issue the command <TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>ls</B
> -l /proc/bus/usb</B
></TT
> . This
should give something similar to
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; dr-xr-xr-x 1 root root 0 Sep 19 14:21 001
dr-xr-xr-x 1 root root 0 Sep 19 14:21 002
-r--r--r-- 1 root root 0 Sep 19 22:30 devices
-r--r--r-- 1 root root 0 Sep 19 22:30 drivers
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13; The path <TT
CLASS="filename"
>&#13; /proc/scsi/usb-storage-0/</TT
> should now exist and one of
the files at the end will show this. In my setup the command
<TT
CLASS="prompt"
>$ </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>less</B
> /proc/scsi/usb-storage-0/1</B
></TT
> gives
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; Host scsi1: usb-storage
Vendor: Generic
Product: Mass Storage Device
Serial Number: None
Protocol: Transparent SCSI
Transport: Bulk
GUID: 0ed166800000000000000000
Attached: Yes/No
</PRE
></FONT
></TD
></TR
></TABLE
><P
>&#13; If the flashdrive is present, the last line will have the entry
"Yes". If it is not plugged in, the entry will be "No".
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="tests"
></A
>7.4. Tests -- vfat</H2
><P
> You are now ready to find out if the memory stick is
working. Let us suppose that you bought it over the counter. Its
instruction leaflet will most likely tell you how to set it up for
Windows. That is an indication that it is formatted in vfat. Before
you try to mount it, create a mount point for it. Do something like
<TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>mkdir</B
> -m 777
/mnt/memstick</B
></TT
>. The mounting command would most likely
be
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; <TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>mount</B
> -t vfat /dev/sda1 /mnt/memstick</B
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
><P
>
If everything went smoothly, you should be able to see the device:
<TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>ls</B
>
/mnt/memstick</B
></TT
>.
</P
><P
>
Now try some standard things like making a directory on the device
and copying a favourite text file to it:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13; <TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>mkdir</B
> /mnt/memstick/apollo </B
></TT
>
<TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>cp</B
> /home/myname/myfavourite_file /mnt/memstick/apollo/.</B
></TT
>
</PRE
></FONT
></TD
></TR
></TABLE
><P
>
List again (<TT
CLASS="prompt"
># </TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>ls</B
> -l /mnt/memstick</B
></TT
> ) and
pay attention to the permissions.
</P
><P
>
Unmount the device (<TT
CLASS="prompt"
>#
</TT
><TT
CLASS="userinput"
><B
><B
CLASS="command"
>umount</B
>
/dev/sda1</B
></TT
> ) and mount it again as above. List again
and check the permissions. Most likely your favourite text file
will now have an x-permission. It became executable. That is
normal in the vfat filesystem. If you are happy with that,
unmount the device and skip to <A
HREF="users.html"
>Section 10</A
> .
</P
></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="basics.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="ext2.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Some basic concepts</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Setting up an Ext2 filesystem</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>