Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2009 15:19:10 +1100
From:      Andrew Snow <andrew@modulus.org>
To:        Clifton Royston <cliftonr@lava.net>, freebsd-stable@freebsd.org
Subject:   Re: Installing FreeBSD from USB flash drive - some experiments
Message-ID:  <49B73BBE.3020302@modulus.org>
In-Reply-To: <20090311032557.GA7735@lava.net>
References:  <20090311032557.GA7735@lava.net>

next in thread | previous in thread | raw e-mail | index | archive | help

Here's the steps I use to create a 1GB USB image:

# dd if=/dev/zero of=bootable.image bs=1m count=1 oseek=1000 conv=sparse
# mdconfig -a -t vnode -f bootable.image -u 0
# newfs -m 0 -o space -n /dev/md0
# mount /dev/md0 /mnt

# cd /usr/src
# make installworld DESTDIR=/mnt
# make distribution DESTDIR=/mnt
# make installkernel DESTDIR=/mnt
# umount /mnt

At this point you have a file "bootable.image" but instead of actually 
making that a bootable dd image, I choose to create a dump file which is 
a bit more flexible as you can restore it to a USB stick of any size.

# dump -0 -C 8 -f - /dev/md0 | gzip -9 > bootable.dump.gz
# mdconfig -d -u 0


At this point, you have a dump file which you can use to create a 
bootable USB as follows:

Assuming the USB stick is /dev/da0 !

# dd if=/dev/zero of=/dev/da0 bs=16k
# fdisk -BI /dev/da0
# disklabel -B -w /dev/da0s1
# newfs -m 0 -o space -n /dev/da0s1a
# mount -o noatime,async /dev/da0s1a /mnt
# gzcat bootable.dump.gz | ( cd /mnt ; restore -rvf - )
# umount /mnt



Hope that helps


- Andrew



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