# Installing from USB flash drive.



## Barnon (May 14, 2009)

I have successfully installed FreeBSD 7.2Release (i386) from a
USB flash drive. It involves a little more work than installing
from CD/DVD but the convenience of having it on a USB flash drive
makes it worth it.

I created a single bootable slice with only a "/" partition. Then I used tar to copy everything from the FreeBSD DVD ISO image to the 
flash drive. I know cpio is a potentially better way to do it, but
I wanted to keep this description simple.

The problem that people have posted on before is that they did not
know how to mount an "existing filesystem" so "sysinstall" can
find the files. Well, this is fairly simple to do as it turns out.
During the drive selection, you see the IDE drive you want to 
install to, and the USB flash drive. Select both , but only partition
the destination drive. When you create the mount points for the
new drive, you will see an entry for the existing USB flash drive
filesystem with no mount point of its own, yet. Select that entry
and hit "m" to set the mount point. I set mine to /mnt, of course
after I created the "/" entry on the destination drive. Now you 
have the mount point, and you can tell sysinstall to mount it
as an existing file system.

I put together a crude first approximation of the process at
http://www.pa.msu.edu/people/tigner/BootUSB.html. I will try
to clean it up when I get a chance, or feel free to improve on
it yourself .


----------



## leo2501 (May 25, 2009)

thank you for the job you take doing this! but i have a problem, i don't have a working freebsd machine yet, i wanna install freebsd in my netbook and i used unetbootin with a couple of isos right now and when i boot it says, CORRUPTED KERNEL IMAGE or something like that... any way you think i can have a working bootable usb disk? my working linux distro have some .img files together with the isos and you only "dd" it to the pendrive and its ready to boot


----------



## leo2501 (May 25, 2009)

i'll try this out http://docs.freebsd.org/cgi/getmsg....2006/freebsd-hackers/20060326.freebsd-hackers

"a tiny script to convert a FreeBSD install iso image to a
binary ufs image ready to be flashed e.g. on an USB pendrive."



EDIT: GRRRR it seems the script is for BSD already  but i didn't have a BSD machine yet


----------



## lme@ (May 26, 2009)

Perhaps you can use a FreesBIE Live CD to create the usb boot pen?


----------



## leo2501 (May 26, 2009)

dont worry, i'll buy a dvd burner and install from there  but it'll be nice to have the img files along with the isos, maybe in the near future


----------



## Barnon (Jun 2, 2009)

*create freebsd flash drive from linux*

Hi, so sorry not to have gotten back to you earlier about this.

I suggest that you install qemu , a hardware emulator that lets
you run filesystem images in a window under X11. I can not give
you step by step instructions on how to do that on a linux kernel
distribution, since I believe it might be affected by exactly
what distribution you are currently using.

Once Qemu is installed, and you have downloaded the FreeBSD iso
that you want, you should be able to create a bootable FreeBSD
partition on the USB flash drive.

For simplicity lets say your bsd image is called BSD.iso, and that
the USB flash drive is currently blank (you can use dd to erase it)
and it shows up as /dev/da0.

qemu -boot d -cdrom BSD.iso -hda /dev/da0

This will let you boot to the BSD.iso in a window under X11. Once
the BSD installer is up, I suggest (again for simplicity) that
you select to install the minimal bsd installation on ad0 (which
is what qemu thinks the usb flash drive is. At this point you the
USB flash drive is a bootable FreeBSD USB flash drive. Exit qemu.

You should now be able to mount the UFS image on the flash drive
to an appropriate mount point (create one if you want). At this
point, delete all files on the flash drive. Now use tar to copy
the contents of the BSD.iso to the mount point you used for the
flash drive. Unmount the flash drive and it should now be a
bootable FreeBSD install device.


----------



## leo2501 (Jun 3, 2009)

thankyou for that guide! i'll try that for sure!


----------



## sprewell (Aug 19, 2009)

This guide worked for me, so much easier than a CD install, particularly since I don't use CDs at all.  I wrote the first CD's iso to my flash stick and was able to do a (kern?)-developer install with X in sysinstall without needing the other CDs.  I'm glad to see that FreeBSD 8.0 will have a flash image to make this even easier, hope the next 7.* releases also have them.  Most of all, sysinstall needs to be replaced with something more current.


----------

