Booting from Memory Stick

John Nielsen john at
Sun Mar 2 03:11:08 UTC 2008

On Saturday 01 March 2008 04:23:24 pm jhall at wrote:
> I am working on getting a FreeBSD system to boot from a USB memory
> stick.
> Would it be possible to install the operating system using the
> following:
> cd /usr/src
> make DESTDIR=/mnt/usbdisk world
> boot0cfg -v -B -o noupdate da0
> Or, is there an easier way to do this?

I know you've gotten some other responses, but I wanted to chime in and 
say that I've done this (just today, actually) using an approach similar 
to what you're outlining. In a nutshell:

(assuming USB stick is da0, you don't care about what's on it, and you 
want to use the whole thing with one partition and no swap)

##prepare the destination disk, including boot blocks, and mount
fdisk -BI /dev/da0	#ignore the GEOM not found message
bsdlabel -wB /dev/da0s1
newfs -U -L mystick /dev/da0s1a	#optional flags for softupdates and label
mount /dev/ufs/mystick /mnt

##prepare obj tree (skip if you already have one with the kernel you want)
cd /usr/src
make buildworld

##install to the stick
cd /usr/src
make KERNCONF=MYUSBKERNEL DESTDIR=/mnt installkernel
make DESTDIR=/mnt installworld
mergemaster -i -D /mnt	#review list, answer yes to followup ?'s

##The only other thing that's required is an fstab file:
echo "/dev/ufs/mystick / ufs rw 1 1" >> /mnt/etc/fstab

##and don't forget to un-mount the stick when you're done
umount /mnt

That's a bit quick and dirty, obviously, but you can boot from the stick 
and have a complete system at this point. Setup of the root password, 
users, groups, hostname, interfaces, timezone, etc not included. 
Sysinstall or manual config (either from the initial host or after 
booting from the stick) can get you the rest of the way. Or  you may 
discover that one of the other approaches suggested is easier. :)


More information about the freebsd-questions mailing list