Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153369630
D8788.id25532.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D8788.id25532.diff
View Options
Index: en_US.ISO8859-1/books/handbook/boot/chapter.xml
===================================================================
--- en_US.ISO8859-1/books/handbook/boot/chapter.xml
+++ en_US.ISO8859-1/books/handbook/boot/chapter.xml
@@ -903,4 +903,42 @@
a module or statically compiled into a custom kernel.</para>
</note>
</sect1>
+
+ <sect1 xml:id="boot-reroot">
+ <title>Root remount</title>
+
+ <note>
+ <para>The reroot functionality is supported
+ starting with &os; 11.0-RELEASE.</para>
+ </note>
+
+ <para>In some cases mounting the root filesystem requires some additional steps
+ which require working userspace. An example of this is booting from an iSCSI LUN - setting up
+ an iSCSI session requires &man.iscsid.8; and &man.iscsictl.8;. This presents
+ a chicken and egg problem. The solution is to boot with temporary root filesystem
+ on a memory disk image preloaded by &man.loader.8;, set up the kernel state as
+ neccessary, replace the temporary root file system with the proper one, and then
+ continue booting as usual.</para>
+
+ <para>First step is to create a temporary root filesystem:</para>
+ <screen><userinput>makefs /boot/reroot.img /usr/share/examples/reroot/manifest</userinput></screen>
+
+ <para>After that is done, configure the &man.loader.8; to preload it by putting
+ the following into <filename>/boot/loader.conf</filename>:</para>
+ <screen>reroot_load="YES"
+reroot_type="md_image"
+reroot_name="/boot/reroot.img"</screen>
+
+ <para>The rc script contained in the image is configured using &man.kenv.1;
+ variables, set in <filename>/boot/loader.conf</filename>, or manually from
+ &man.loader.8; prompt: reroot_iface, reroot_ifconfig, reroot_sh,
+ reroot_iscsi_target, reroot_iscsi_portal, reroot_mountfrom.</para>
+
+ <para>As an example, to mount root from an iSCSI volume, use the following:</para>
+ <screen>reroot_iface=em0
+reroot_iscsi_target=iqn.2012-06.com.example:target0
+reroot_iscsi_portal=192.168.1.5
+reroot_mountfrom=ufs:/dev/da0</screen>
+
+ </sect1>
</chapter>
Index: en_US.ISO8859-1/books/handbook/disks/chapter.xml
===================================================================
--- en_US.ISO8859-1/books/handbook/disks/chapter.xml
+++ en_US.ISO8859-1/books/handbook/disks/chapter.xml
@@ -580,6 +580,129 @@
any block device, including optical drives or
<acronym>iSCSI</acronym> <acronym>LUN</acronym>s.</para>
</sect2>
+
+ <sect2>
+ <title>USB Mass Storage Target</title>
+
+ <note>
+ <para>The &man.cfumass.4; driver is a <acronym>USB</acronym> device
+ mode driver that first became available in &os; 12.0-CURRENT.
+ </para>
+ </note>
+
+ <para>When running on <acronym>USB OTG</acronym>-compliant hardware
+ like that built into many
+ embedded boards - the &os; <acronym>USB</acronym> stack can run in
+ device mode.
+ Device mode makes it possible to present itself as different kinds
+ of <acronym>USB</acronym> device classes, including serial ports,
+ network adapters, and mass storage. A <acronym>USB</acronym>
+ host like a laptop or desktop computer is able to access them just
+ like physical <acronym>USB</acronym> devices.</para>
+
+ <para>Device mode support uses the &man.usb.template.4; kernel module.
+ When it is is loaded, the <acronym>USB</acronym> stack switches
+ between host-side and device-side automatically, depending
+ on what is connected to the <acronym>USB</acronym> port.
+ Connecting a <acronym>USB</acronym> device like a memory stick
+ to the <acronym>USB OTG</acronym> port causes &os; to switch to host
+ mode. Connecting a <acronym>USB</acronym> host like a computer
+ causes &os; to switch to device mode.</para>
+
+ <para>What &os; presents to the <acronym>USB</acronym> host
+ depends on the <varname>hw.usb.template</varname> sysctl. See
+ &man.usb.template.4; for the list of available values. Note
+ that for the host to take notice of the configuration change,
+ it must be either physically disconnected and reconnected,
+ or forced to rescan the
+ <acronym>USB</acronym> bus in a system-specific way.
+ When &os; is running on the host, the <command>reset</command>
+ subcommand of
+ &man.usbconfig.8; command can be used. This also must be done
+ after loading <filename>usb_template.ko</filename> if the
+ <acronym>USB</acronym> host was already connected to the
+ <acronym>USB OTG</acronym> socket.</para>
+
+ <para>By default, the <varname>hw.usb.template</varname> sysctl
+ is set to 0, making &os; work as a <acronym>USB</acronym>
+ Mass Storage target. Both &man.usb.template.4; and
+ &man.cfumass.4; kernel modules must be loaded.
+ The &man.cfumass.4; interfaces to the CTL subsystem, the same one
+ that is used for <acronym>iSCSI</acronym> or Fibre Channel targets.
+ On the host side, <acronym>USB</acronym> Mass Storage initiators
+ can only access a single <acronym>LUN</acronym>,
+ LUN 0.</para>
+
+ <para><acronym>USB</acronym> Mass Storage
+ does not require the &man.ctld.8; daemon to be running, although
+ it can be used if desired. This is different from iSCSI. Thus,
+ there are two ways to configure the target: &man.ctladm.8;,
+ or &man.ctld.8;. Both require the <filename>cfumass.ko</filename>
+ kernel module to be loaded. The module can be loaded manually:</para>
+
+ <screen>&prompt.root; <userinput>kldload cfumass</userinput></screen>
+
+ <para>If the <filename>cfumass.ko</filename> kernel module
+ has not been built into kernel, the
+ <filename>/boot/loader.conf</filename> should be edited to load
+ the module at boot:</para>
+
+ <programlisting>cfumass_load="YES"</programlisting>
+
+ <para>A <acronym>LUN</acronym> can be created without &man.ctld.8;
+ daemon running:</para>
+
+ <screen>&prompt.root; <userinput>ctladm create -b block -o file=/data/target0</userinput></screen>
+
+ <para>This presents contents of the image file
+ <filename>/data/target0</filename> as a <acronym>LUN</acronym> to the
+ <acronym>USB</acronym> host. The file must exist before executing
+ the command. To configure the <acronym>LUN</acronym> at system startup,
+ add the command to <filename>/etc/rc.local</filename>.</para>
+
+ <para>&man.ctld.8; can also be used to manage <acronym>LUN</acronym>s. Create
+ <filename>/etc/ctl.conf</filename>, add a line to <filename>/etc/rc.conf</filename>
+ to make sure the &man.ctld.8; daemon is automatically started at boot, and then
+ start the daemon.</para>
+
+ <para>The following is an example of a simple
+ <filename>/etc/ctl.conf</filename> configuration file. Refer
+ to &man.ctl.conf.5; for a more complete description of this
+ file's available options.</para>
+ <programlisting>target naa.50015178f369f092 {
+ lun 0 {
+ path /data/target0
+ size 4G
+ }
+}</programlisting>
+
+ <para>This creates a single target with a single <acronym>LUN</acronym>.
+ The <literal>naa.50015178f369f092</literal> is a device
+ identifier It is made of random 32 hexadecimal digits.
+ The <literal>path /data/target0-0</literal> line
+ defines the full path to a file or zvol backing the
+ <acronym>LUN</acronym>. That file must exist before starting
+ &man.ctld.8;. The second line is optional and specifies the
+ size of the <acronym>LUN</acronym>.</para>
+
+ <para>To make sure the &man.ctld.8; daemon is started at
+ boot, add this line to
+ <filename>/etc/rc.conf</filename>:</para>
+
+ <programlisting>ctld_enable="YES"</programlisting>
+
+ <para>To start &man.ctld.8; now, run this command:</para>
+
+ <screen>&prompt.root; <userinput>service ctld start</userinput></screen>
+
+ <para>As the &man.ctld.8; daemon is started, it reads
+ <filename>/etc/ctl.conf</filename>. If this file is edited
+ after the daemon starts, reload the changes so they take
+ effect immediately:</para>
+
+ <screen>&prompt.root; <userinput>service ctld reload</userinput></screen>
+
+ </sect2>
</sect1>
<sect1 xml:id="creating-cds">
Index: share/xml/man-refs.ent
===================================================================
--- share/xml/man-refs.ent
+++ share/xml/man-refs.ent
@@ -7060,6 +7060,7 @@
<!ENTITY man.central.4 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>central</refentrytitle><manvolnum>4</manvolnum></citerefentry>">
<!ENTITY man.cfi.4 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>cfi</refentrytitle><manvolnum>4</manvolnum></citerefentry>">
<!ENTITY man.cfid.4 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>cfid</refentrytitle><manvolnum>4</manvolnum></citerefentry>">
+<!ENTITY man.cfumass.4 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>cfumass</refentrytitle><manvolnum>4</manvolnum></citerefentry>">
<!ENTITY man.ch.4 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>ch</refentrytitle><manvolnum>4</manvolnum></citerefentry>">
<!ENTITY man.ciss.4 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>ciss</refentrytitle><manvolnum>4</manvolnum></citerefentry>">
<!ENTITY man.clkbrd.4 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>clkbrd</refentrytitle><manvolnum>4</manvolnum></citerefentry>">
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 6:32 PM (12 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31925999
Default Alt Text
D8788.id25532.diff (9 KB)
Attached To
Mode
D8788: Document USB Mass Storage CTL frontend.
Attached
Detach File
Event Timeline
Log In to Comment