Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Thread Tools Display Modes
  #1   (View Single Post)  
Old 10th February 2010
FBSD FBSD is offline
Real Name: Joe Barbish
Join Date: Feb 2010
Location: Angeles City, Philippines
Posts: 19
Thanked 4 Times in 3 Posts
Default Creating USB flash drive drive image from FreeBSD disc1.iso

This is not yet updated in the the handbook -- but the
is an new addition to the FBSD install media world. This is a DD copy of an fixit sysinstall running system. Its very large is size. Three times larger then the disc1.iso. I tested this memstick.img and was unhappy with how long it took to download. In release 8.0 the sysinstall process was updated and now has USB support as option to select where the install files come from.

The thing you have to keep in mind is that most bios older that 2008 do not have option to boot from USB sticks or can only boot from a few different vendor USB sticks. Some vendor sticks will not be reconized by your bios as bootable. Testing the USB stick is the only way to find out if its bootable on your PC.

I normally download the disc1.iso and use the following script to load it to a USB flash drive.

#Purpose = Use to transfer the FreeBSD install cd1 to
#      a bootable 1GB USB flash drive so it can be used to install from.
#      First fetch the FreeBSD 8.0-RELEASE-i386-disc1.iso to your
#      hard drive /usr. Then execute this script from the command line
# fbsd2usb /usr/8.0-RELEASE-i386-disc1.iso /usr/8.0-disc1.img
# Change system bios to boot from USB-dd and away you go.
# NOTE: This script has to be run from root and your 1GB USB flash drive
#       has to be plugged in before running this script.
# On the command line enter    fbsd2usb iso-path img-path
# You can set some variables here. Edit them to fit your needs.
# Set serial variable to 0 if you don't want serial console at all,
# 1 if you want comconsole and 2 if you want comconsole and vidconsole
set -u
if [ $# -lt 2 ]; then
    echo "Usage: $0 source-iso-path output-img-path"
    exit 1
isoimage=$1; shift
imgoutfile=$1; shift
# Temp  directory to be used later
#export tmpdir=$(mktemp -d -t fbsdmount)
export tmpdir=$(mktemp -d /usr/fbsdmount)
export isodev=$(mdconfig -a -t vnode -f ${isoimage})
ISOSIZE=$(du -k ${isoimage} | awk '{print $1}')
SECTS=$((($ISOSIZE + ($ISOSIZE/5))*4))
#SECTS=$((($ISOSIZE + ($ISOSIZE/5))*2))
echo " "
echo "### Initializing image File started ###"
echo "### This will take about 1 minute ###"
dd if=/dev/zero of=${imgoutfile} count=${SECTS}
echo "### Initializing image File completed ###"
echo " "
ls -l ${imgoutfile}
export imgdev=$(mdconfig -a -t vnode -f ${imgoutfile})
bsdlabel -w -B ${imgdev}
newfs -O1 /dev/${imgdev}a
mkdir -p ${tmpdir}/iso ${tmpdir}/img
mount -t cd9660 /dev/${isodev} ${tmpdir}/iso
mount /dev/${imgdev}a ${tmpdir}/img
echo " "
echo "### Started Copying files to the image now ###"
echo "### This will take about 6 minutes ###"
( cd ${tmpdir}/iso && find . -print -depth | cpio -dump ${tmpdir}/img )
echo "### Completed Copying files to the image ###"
if [ ${serial} -eq 2 ]; then
        echo "-D" > ${tmpdir}/img/boot.config
        echo 'console="comconsole, vidconsole"' >>   ${tmpdir}/img/boot/loader.conf
#### note   the above is a wrap. it should be moved after the >> above
elif [ ${serial} -eq 1 ]; then
        echo "-h" > ${tmpdir}/img/boot.config
        echo 'console="comconsole"' >> ${tmpdir}/img/boot/loader.conf
echo " "
echo "### Started writing image to flash drive now ###"
echo "### This will take about 16 minutes ###"
dd if=${imgoutfile} of=/dev/da0 bs=1m
echo "### Completed writing image to flash drive at ###"
cleanup() {
    umount ${tmpdir}/iso
    mdconfig -d -u ${isodev}
    umount ${tmpdir}/img
    mdconfig -d -u ${imgdev}
    rm -rf ${tmpdir}
ls -lh ${imgoutfile}
echo "### Script finished ###"
FreeBSD Install Guide www.a1poweruser.com

Last edited by FBSD; 3rd March 2010 at 12:40 PM.
Reply With Quote
  #2   (View Single Post)  
Old 10th February 2010
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Helpful companion
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Thanked 193 Times in 184 Posts

Yeah, it seems they removed the boot floppies for this release.. guess they considered this a fair trade off.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FYI: v4.6 install to USB Flash Drive success s2scott OpenBSD Installation and Upgrading 0 16th November 2009 05:59 PM
Backup to USB flash drive giga FreeBSD General 5 8th December 2008 11:06 PM
which Flash Drive I must buy for FreeBSD and OpenBSD mfaridi General Hardware 18 22nd October 2008 07:43 PM
backup drive to image file milo974 OpenBSD General 8 14th August 2008 02:01 PM
USB flash drive criglerj NetBSD General 1 26th July 2008 01:25 AM

All times are GMT. The time now is 06:49 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick