Add a new section: "USB Storage Devices" which covers the

configuration of FreeBSD to use USB thumbdrives, hard drives, etc.
Some parts of that section come from an article I wrote for
www.bsdnews.org, many persons found that article useful and asked me to
add the same informations in the Handbook.
This commit is contained in:
Marc Fonvieille 2004-07-05 12:22:33 +00:00
parent 5a1b072491
commit 6a1d7bf4ad
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=21359

View file

@ -726,6 +726,138 @@ ar0: ATA RAID1 subdisks: ad4 ad6 status: REBUILDING 0% completed</screen>
</sect2>
</sect1>
<sect1 id="usb-disks">
<sect1info>
<authorgroup>
<author>
<firstname>Marc</firstname>
<surname>Fonvieille</surname>
<contrib>Contributed by </contrib>
</author>
</authorgroup>
<!-- Jul 2004 -->
</sect1info>
<title>USB Storage Devices</title>
<indexterm>
<primary>USB</primary>
<secondary>disks</secondary>
</indexterm>
<para>A lot of external storage solutions, nowadays, use the
Universal Serial Bus (USB): hard drives, USB thumbdrives, CD-R
burners, etc. &os; provides support for these devices.</para>
<sect2>
<title>Configuration</title>
<para>The USB mass storage devices driver, &man.umass.4;,
provides the support for USB storage devices. If you use the
<filename>GENERIC</filename> kernel, you do not have to change
anything in your configuration. If you use a custom kernel,
be sure that the following lines are present in your kernel
configuration file:</para>
<programlisting>device scbus
device da
device pass
device uhci
device ohci
device usb
device umass</programlisting>
<para>The &man.umass.4; driver uses the SCSI subsystem to access
to the USB storage devices, your USB device will be seen as a
SCSI device by the system. Depending on the USB chipset on
your motherboard, you only need one of both <literal>device
uhci</literal> and <literal>device ohci</literal>, however
having both in the kernel configuration file is harmless. Do
not forget to compile and install the new kernel if you added
any lines.</para>
<note>
<para>If your USB device is a CD-R burner, the SCSI CD-ROM
driver, &man.cd.4;, must be added to the kernel via the
line:</para>
<programlisting>device cd</programlisting>
<para>Since the burner is seen as a SCSI drive, the driver
&man.atapicam.4; should not be used in the kernel
configuration.</para>
</note>
<para>Support for USB 2.0 controllers is provided on
&os;&nbsp;5.X and since &os;&nbsp;4.10-RELEASE for the 4.X
branch. You have to add:</para>
<programlisting>device ehci</programlisting>
<para>to your configuration file for the USB 2.0 support. Note
&man.uhci.4; and &man.ohci.4; drivers are still needed if you
want USB 1.X support.</para>
<note>
<para>On &os;&nbsp;4.X, the USB daemon (&man.usbd.8;) must be
running to be able to see some USB devices. To enable it,
add <literal>usbd_enable="YES"</literal> to your
<filename>/etc/rc.conf</filename> file and reboot the
machine.</para>
</note>
</sect2>
<sect2>
<title>Testing the Configuration</title>
<para>The configuration is ready to be tested: plug in your USB
device, and in the system message buffer (&man.dmesg.8;), the
drive should appear as something like:</para>
<screen>umass0: USB Solid state disk, rev 1.10/1.00, addr 2
GEOM: create disk da0 dp=0xc2d74850
da0 at umass-sim0 bus 0 target 0 lun 0
da0: &lt;Generic Traveling Disk 1.11&gt; Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: 126MB (258048 512 byte sectors: 64H 32S/T 126C)</screen>
<para>Of course, the brand, the device node
(<devicename>da0</devicename>) and other details can differ
according to your configuration.</para>
<para>Since the USB device is seen as a SCSI one, the
<command>camcontrol</command> command can be used to list the
USB storage devices attached to the system:</para>
<screen>&prompt.root; <userinput>camcontrol devlist</userinput>
&lt;Generic Traveling Disk 1.11&gt; at scbus0 target 0 lun 0 (da0,pass0)</screen>
<para>If the drive comes with a file system, you should be able
to mount it. The <xref linkend="disks-adding"> will help you
to format and create partitions on the USB drive if
needed.</para>
<para>If you unplug the device (the disk must be unmounted
before), you should see, in the system message buffer,
something like the following:</para>
<screen>umass0: at uhub0 port 1 (addr 2) disconnected
(da0:umass-sim0:0:0:0): lost device
(da0:umass-sim0:0:0:0): removing device entry
GEOM: destroy disk da0 dp=0xc2d74850
umass0: detached</screen>
</sect2>
<sect2>
<title>Further Reading</title>
<para>Beside the <link linkend="disks-adding">Adding
Disks</link> and <link linkend="mount-unmount">Mounting and
Unmounting File Systems</link> sections, reading various
manual pages may be also useful: &man.umass.4;,
&man.camcontrol.8;, and &man.usbdevs.8;.</para>
</sect2>
</sect1>
<sect1 id="creating-cds">
<sect1info>
<authorgroup>