# Boot from USB Memory Stick



## Anonymous (Nov 26, 2010)

Hi,

I prepared on a secondary internal hard drive a skeleton FreeBSD 8.1-RELEASE (GENERIC) system, that features the complete setup for my purpose, but does not contain any data. I verified that the ssytem is working according to my needs.

In a second step I prepared an USB memory stick with being bootable with the more or less standard UFS slices:


```
server:~ root# gpart show da0  
=>     63  7831467  da0  MBR  (3.7G)
       63  7831467    1  freebsd  [active]  (3.7G)

server:~ root# gpart show da0s1
=>      0  7831467  da0s1  BSD  (3.7G)
        0   393216      1  freebsd-ufs  (192M)
   393216  1572864      2  freebsd-swap  (768M)
  1966080   196608      4  freebsd-ufs  (96M)
  2162688   196608      5  freebsd-ufs  (96M)
  2359296  5472171      6  freebsd-ufs  (2.6G)
```

Then I transferred said skeleton system to the USB stick, and I changed /etc/fstab at the USB stick to have the proposed device names /dev/da0s1a-f:

```
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/da0s1b             none            swap    sw              0       0
/dev/da0s1a             /               ufs     rw              1       1
/dev/da0s1e             /tmp            ufs     rw              1       1
/dev/da0s1f             /usr            ufs     rw              1       1
/dev/da0s1d             /var            ufs     rw              1       1
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
```


If I reboot the computer with this USB stick plugged-in, the computer starts from it, but it hangs requesting a manual mountroot.


```
Nov 25 08:11:19 server kernel: Trying to mount root from ufs:/dev/da0s1a
Nov 25 08:11:19 server kernel: ROOT MOUNT ERROR: 
Nov 25 08:11:19 server kernel: If you have invalid mount options, reboot, and first try the following from
Nov 25 08:11:19 server kernel: the loader prompt:
Nov 25 08:11:19 server kernel: set vfs.root.mountfrom.options=rw
Nov 25 08:11:19 server kernel: da0: 
Nov 25 08:11:19 server kernel: and then remove invalid mount options from 
Nov 25 08:11:19 server kernel: /etc/fstab.
Nov 25 08:11:19 server kernel: 
Nov 25 08:11:19 server kernel: Loader variables:
Nov 25 08:11:19 server kernel: 
Nov 25 08:11:19 server kernel: vfs.root.mountfrom=ufs:/dev/da0s1a
Nov 25 08:11:19 server kernel: vfs.root.mountfrom.options=rw
Nov 25 08:11:19 server kernel: 
Nov 25 08:11:19 server kernel: Manual root filesystem specification:
Nov 25 08:11:19 server kernel: <fstype>:<device>  Mount <device> using filesystem <fstype>
Nov 25 08:11:19 server kernel: eg. ufs:/dev/da0s1a
Nov 25 08:11:19 server kernel: eg. cd9660:/dev/acd0
Nov 25 08:11:19 server kernel: This is equivalent to: mount -t cd9660 /dev/acd0 /
Nov 25 08:11:19 server kernel: 
Nov 25 08:11:19 server kernel: ?                  List valid disk boot devices
Nov 25 08:11:19 server kernel: <empty line>       Abort manual input
Nov 25 08:11:19 server kernel: 
Nov 25 08:11:19 server kernel: mountroot> ufs:/dev/da0s1a
Nov 25 08:11:19 server kernel: Trying to mount root from ufs:/dev/da0s1a
```

So the system is throwing a ROOT MOUNT ERROR when "Trying to mount root from ufs:/dev/da0s1a". However, when I enter exactly that device node at the mountroot> prompt, the system happily boots from the USB stick, and I verified that everything is running as expected.

I am researching now two days on this issue and I have still no idea how I can get the system boot from the USB stick in one shot, i.e. without needing to enter something at the mountroot> prompt.

I would be grateful for any insights on what is going on here.

Many thanks in advance and best regards

Rolf


----------



## wblock@ (Nov 26, 2010)

In /boot/loader.conf, set

```
kern.cam.boot_delay=10000
```


----------



## Anonymous (Nov 26, 2010)

Warren,

Many thanks for the quick reply. That did the trick.

Best regards

Rolf


----------

