I was really taken with the idea for using a USB flash stick disk drive to 
install FreeBSD from. I used the script from the mentioned URL below as the 
starting point. After some changes to the script I got it to work. I was able 
to boot off the USB flash stick disk drive, But then was faced with a show 
stopper. During the sysinstall process after it asks for hard drive fdisk and 
bsdlable info it asks you for where to get the install files from (IE: cdrom, 
remote ftp, floppy, dos partition, ECT) there is no option to tell the 
sysinstall program to use USB-dd as source location. 

So in summary, this idea is un-usable until the sysinstall program gets updated 
to include an option to use USB-dd as an install source.  This brings to light 
another problem. That is using floppies to install FreeBSD from. PC 
manufactures are no longer building systems with floppies drives included. 
Combining the FreeBSD floppy images to a single USB-dd image would be away to 
continue to offer this method of installing FreeBSD.

Included below is my working script to populate a 1GB USB flash stick disk with 
the FreeBSD cd1 iso file.

#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 6.2-RELEASE-i386-disc1.iso to your
#          hard drive /usr. Then execute this script from the command line
# fbsd2usb /usr/6.2-RELEASE-i386-disc1.iso /usr/6.2-RELEASE-i386-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 4 minutes ###"
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 15 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"' >> 
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 30 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 ###"

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ross Penner
Sent: Wednesday, August 01, 2007 2:34 PM
To: User questions
Subject: Installing from USB Flash Drive

Hi everybody,

I'm trying to install a system on a machine that doesn't have an optical 
drive. I plan on using a USB flash drive to do the job and found a 
messages from [EMAIL PROTECTED] 
(http://www.mail-archive.com/[EMAIL PROTECTED]/msg55434.html) 
about just such a thing. The script provided converts the CD image into 
one suitable for a flashmemory stick. I used  and coverted it without 
issue. The instructions say to use dd to prepare the flash drive so 
#dd if=flashbsd.iso of=/dev/da0
I'm not entirely confident that that was the correct procedure, as I'm 
quite unfamilar with dd. Unfortunetly, I can't seem to get the drive to 
boot. I can mount the filesystem so it seems that prepareing the drive was 
succesful. I'm using a via chipset and yes, the bios is set to boot from 
USB-FDD. I used the 6.2 boot only image.

Thanks for any insight you can provide me.


sig ho!
freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to