Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 2008 20:52:18 +0800
From:      "FBSD1" <fbsd1@a1poweruser.com>
To:        "Carl Voth" <cvoth@telus.net>, <freebsd-questions@freebsd.org>
Subject:   RE: cannot install from existing UFS thumb drive with sysinstall
Message-ID:  <NBECLJEKGLBKHHFFANMBAEJMCLAA.fbsd1@a1poweruser.com>
In-Reply-To: <48EF33E1.2030503@telus.net>

next in thread | previous in thread | raw e-mail | index | archive | help
There is a outstanding PR on sysinstall from usb flash drive which is now
over a year old. The sysinstall install program needs to be updated to use
usb drives as the source of the install media. You could always edit the
sysinstall program source code and make a patch to allow usb sysinstall
media.  Other than that you are S.O.L.

I use this script to build my bootable 1GB USB flash drive

#!/bin/sh
#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
serial=0

set -u

if [ $# -lt 2 ]; then
    echo "Usage: $0 source-iso-path output-img-path"
    exit 1
fi

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 ###"
date
dd if=/dev/zero of=${imgoutfile} count=${SECTS}
echo "### Initializing image File completed ###"
date

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 ###"
date

( cd ${tmpdir}/iso && find . -print -depth | cpio -dump ${tmpdir}/img )

echo "### Completed Copying files to the image ###"
date

if [ ${serial} -eq 2 ]; then
        echo "-D" > ${tmpdir}/img/boot.config
        echo 'console="comconsole, vidconsole"' >>
${tmpdir}/img/boot/loader.conf
elif [ ${serial} -eq 1 ]; then
        echo "-h" > ${tmpdir}/img/boot.config
        echo 'console="comconsole"' >> ${tmpdir}/img/boot/loader.conf
fi

echo " "
echo "### Started writing image to flash drive now ###"
echo "### This will take about 30 minutes ###"
date
dd if=${imgoutfile} of=/dev/da0 bs=1m
echo "### Completed writing image to flash drive at ###"
date

cleanup() {
    umount ${tmpdir}/iso
    mdconfig -d -u ${isodev}
    umount ${tmpdir}/img
    mdconfig -d -u ${imgdev}
    rm -rf ${tmpdir}
}

cleanup

ls -lh ${imgoutfile}

echo "### Script finished ###"



-----Original Message-----
From: owner-freebsd-questions@freebsd.org
[mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Carl Voth
Sent: Friday, October 10, 2008 6:52 PM
To: freebsd-questions@freebsd.org
Subject: Re: cannot install from existing UFS thumb drive with sysinstall

Is there no one out there that can help?

I've dug into NFS a little more and that does not appear to support
mounting a local filesystem under sysinstall.

In the following thread, Richard Tobin makes an assertion that suggests
that I might be able to mount my thumb drive's existing UFS partition in
the disk labelling step.

http://unix.derkeiler.com/Newsgroups/comp.unix.bsd.freebsd.misc/2004-10/0920
.html
[ http://tinyurl.com/3mknq7 ]

The first problem I ran into was that there is no way to add a second
drive (ie. target drive is SATA hard disk, thumb drive is install drive)
to the disk labelling step. The only way that that can be achieved is by
first adding it to the fdisk partitioning step. I'm willing to believe
that *maybe* there's no risk to my thumb drive in rewriting it's disk
label if I'm very careful not to newfs it. But nothing about the fdisk
partition editor gives me a sense that it will hold off of rewriting my
thumb drive's slice table even though I'm not trying to change anything.
It just seems perverse to have to reslice and relabel just to mount an
existing filesystem. If the only way one can mount a local filesystem in
sysinstall is using the disk label editor, can someone explain to me the
actual consequences and risks of this procedure? I did not proceed to
Write or Commit in this little experiment yet because of the unknown risks.

I have to say that I cannot believe how horribly unfriendly sysinstall
is for anyone wanting to use a USB thumb drive as an install medium. In
fact, it's looking totally unusable.

Clearly sysinstall is utilizing 'mount' functionality for it's own
purposes. Surely there's some way for me to access it too?!?

Carl                                             / K0802647
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NBECLJEKGLBKHHFFANMBAEJMCLAA.fbsd1>