Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 2014 01:28:35 +1000 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        Michael Sierchio <kudzu@tenebras.com>
Cc:        freebsd-questions@freebsd.org, atar <atar.yosef@gmail.com>, Derek Ragona <derek@computinginnovations.com>, Darren Pilgrim <list_freebsd@bluerosetech.com>
Subject:   Re: Using the ISO releases on USB sticks.
Message-ID:  <20140911224106.X61666@sola.nimnet.asn.au>
In-Reply-To: <mailman.81.1410436802.71426.freebsd-questions@freebsd.org>
References:  <mailman.81.1410436802.71426.freebsd-questions@freebsd.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
In freebsd-questions Digest, Vol 536, Issue 5, Message: 25
On Wed, 10 Sep 2014 18:16:22 -0400 Michael Sierchio <kudzu@tenebras.com> writes:
 > On Wed, Sep 10, 2014 at 12:34 PM, atar <atar.yosef@gmail.com> wrote: 
 > > I know about the 'memstick.img' version but I want just the ISO 
 > > versions because they have more softwares installed on them right 
 > > from the package and I want to use them just from my USB stick.
 > 
 > There are tools that make an ISO image into a bootable USB stick.
 > 
 > http://bit.ly/1rX250x

The LMGTFY page that points to falsely insists my JS isn't enabled, and 
googling 'iso to usb freebsd' found plenty of mostly dead ends and red 
herrings - you may be luckier :)

What works[*] is the below script by Darren Pilgrim, derived from the 
/usr/src/release scripts with a tar joiner.  I just used it to make a 
2GB FreeBSD-9.3-RELEASE-amd64-dvd1-memstick.img .. not yet installed.

========
#!/bin/sh
# originally by Darren Pilgrim 17/12/13 from http://pastebin.com/fzgVaCgW
# smithi@nimnet.asn.au 22/2/14 for FreeBSD 8.2-R (no makefs label option)
# compaction & extra paranoia 23/6/14; rm 8.2 hack, quit() tidyup 11/9/14

PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH

if [ -z "$*" ]; then
    echo `basename $0 [dvd1 img] [dvd1 dir] [memstick img] [memstick dir]`
    echo ' [dvd1 img] is the dvd1 image to convert'
    echo ' [dvd1 dir] is the mountpoint for the dvd1 image'
    echo ' [memstick img] is name of the memstick image file to create'
    echo ' [memstick dir] is temporary work directory for memstick contents'
    exit 1
fi

quit() { echo "$1" ; exit 1 ; }

[ `id -u` -ne 0 ] && quit "This script must be run as root"
[ ! -f $1 ] && quit "Source dvd1 image $1 does not exist"
[ ! -d $2 ] && quit "dvd1 dir mountpoint $2 must be a directory"
[ -e $3 ] && quit "Memstick img file $3 already exists"
[ ! -d $4 ] && quit "Memstick dir $4 not an existing directory"
[ `du -sm $4 | awk '{print $1}'` -gt 2 ] && quit "Memstick dir $4 not empty"

unit=`mdconfig -f $1` || quit "dvd1 img mdconfig fail"
mount_cd9660 /dev/$unit $2 || quit "mount_cd9660 fail"

tar cf - -C $2 . | tar xpf - -C $4 || quit "tar pipeline fail"

umount $2 && mdconfig -d -u $unit || quit "Could not umount dvd1"

echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > $4/etc/fstab
makefs -B little -o label=FreeBSD_Install $3 $4 || quit "makefs fail"

unit=`mdconfig -f $3` || quit "memstick img mdconfig fail"
gpart create -s BSD $unit || quit "gpart create -s BSD fail"
gpart bootcode -b $4/boot/boot $unit || quit "gpart bootcode fail"
gpart add -t freebsd-ufs $unit || quit "gpart add -t freebsd-ufs fail"
mdconfig -d -u $unit
echo "Memstick image $3 created:" ; ls -l $3
=======

[*] These images boot and install FreeBSD fine, however with 10.0-R, 
bsdconfig failed to install included packages, due to relying on how it 
_detected_ its media not as a CD/DVD but as USB/other, and so not 
pointing pkg(8) to its local package repository - thus needing an online 
connection, rather contrary to the point of a DVD[-like] install ..

When I can find a spare box to test on, I hope to try a patch to fix 
this - unless 9.3-R is already updated from 10.0-R in this respect?

So with 10-R, as things stand, this won't work for atar's primary aim.

Once installed and rebooted, you could perhaps add its packages/All/ to 
a properly pre-configured local repo then install pkgs from that, but I 
don't grok pkg(8) at all well yet .. fortunately, others do.

I've just seen Matthias Apitz' post; more complicated but thorough.  If 
atar works through that there's lots to be learned.  The above is more 
just for moving a release from .iso to .img format fairly quickly.

cheers, Ian



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20140911224106.X61666>