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. + + + Root remount + + + The reroot functionality is supported + starting with &os; 11.0-RELEASE. + + + 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. + + First step is to create a temporary root filesystem: + makefs /boot/reroot.img /usr/share/examples/reroot/manifest + + After that is done, configure the &man.loader.8; to preload it by putting + the following into /boot/loader.conf: + reroot_load="YES" +reroot_type="md_image" +reroot_name="/boot/reroot.img" + + The rc script contained in the image is configured using &man.kenv.1; + variables, set in /boot/loader.conf, or manually from + &man.loader.8; prompt: reroot_iface, reroot_ifconfig, reroot_sh, + reroot_iscsi_target, reroot_iscsi_portal, reroot_mountfrom. + + As an example, to mount root from an iSCSI volume, use the following: + reroot_iface=em0 +reroot_iscsi_target=iqn.2012-06.com.example:target0 +reroot_iscsi_portal=192.168.1.5 +reroot_mountfrom=ufs:/dev/da0 + + 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 iSCSI LUNs. + + + USB Mass Storage Target + + + The &man.cfumass.4; driver is a USB device + mode driver that first became available in &os; 12.0-CURRENT. + + + + When running on USB OTG-compliant hardware + like that built into many + embedded boards - the &os; USB stack can run in + device mode. + Device mode makes it possible to present itself as different kinds + of USB device classes, including serial ports, + network adapters, and mass storage. A USB + host like a laptop or desktop computer is able to access them just + like physical USB devices. + + Device mode support uses the &man.usb.template.4; kernel module. + When it is is loaded, the USB stack switches + between host-side and device-side automatically, depending + on what is connected to the USB port. + Connecting a USB device like a memory stick + to the USB OTG port causes &os; to switch to host + mode. Connecting a USB host like a computer + causes &os; to switch to device mode. + + What &os; presents to the USB host + depends on the hw.usb.template 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 + USB bus in a system-specific way. + When &os; is running on the host, the reset + subcommand of + &man.usbconfig.8; command can be used. This also must be done + after loading usb_template.ko if the + USB host was already connected to the + USB OTG socket. + + By default, the hw.usb.template sysctl + is set to 0, making &os; work as a USB + 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 iSCSI or Fibre Channel targets. + On the host side, USB Mass Storage initiators + can only access a single LUN, + LUN 0. + + USB 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 cfumass.ko + kernel module to be loaded. The module can be loaded manually: + + &prompt.root; kldload cfumass + + If the cfumass.ko kernel module + has not been built into kernel, the + /boot/loader.conf should be edited to load + the module at boot: + + cfumass_load="YES" + + A LUN can be created without &man.ctld.8; + daemon running: + + &prompt.root; ctladm create -b block -o file=/data/target0 + + This presents contents of the image file + /data/target0 as a LUN to the + USB host. The file must exist before executing + the command. To configure the LUN at system startup, + add the command to /etc/rc.local. + + &man.ctld.8; can also be used to manage LUNs. Create + /etc/ctl.conf, add a line to /etc/rc.conf + to make sure the &man.ctld.8; daemon is automatically started at boot, and then + start the daemon. + + The following is an example of a simple + /etc/ctl.conf configuration file. Refer + to &man.ctl.conf.5; for a more complete description of this + file's available options. + target naa.50015178f369f092 { + lun 0 { + path /data/target0 + size 4G + } +} + + This creates a single target with a single LUN. + The naa.50015178f369f092 is a device + identifier It is made of random 32 hexadecimal digits. + The path /data/target0-0 line + defines the full path to a file or zvol backing the + LUN. That file must exist before starting + &man.ctld.8;. The second line is optional and specifies the + size of the LUN. + + To make sure the &man.ctld.8; daemon is started at + boot, add this line to + /etc/rc.conf: + + ctld_enable="YES" + + To start &man.ctld.8; now, run this command: + + &prompt.root; service ctld start + + As the &man.ctld.8; daemon is started, it reads + /etc/ctl.conf. If this file is edited + after the daemon starts, reload the changes so they take + effect immediately: + + &prompt.root; service ctld reload + + Index: share/xml/man-refs.ent =================================================================== --- share/xml/man-refs.ent +++ share/xml/man-refs.ent @@ -7060,6 +7060,7 @@ central4"> cfi4"> cfid4"> +cfumass4"> ch4"> ciss4"> clkbrd4">