Installing FreeBSD from USB flash drive - some experiments
Andrew Snow
andrew at modulus.org
Tue Mar 10 21:21:42 PDT 2009
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
More information about the freebsd-stable
mailing list