install freebsd from inside another operating system

Robin Becker robin at
Mon Dec 15 04:19:28 PST 2008

After some messing around  with various efforts on the depenguinator I came up 
with this scheme for getting a freebsd boot using an external freebsd machine ie 
not using the target to create the boot.

##freebsd machine
#get the freebsd bootonly location
wget [use your local location]/7.1-RC1-i386-bootonly.iso

#determine its size (in my case 39M)
ls -l 7.1-RC1-i386-bootonly.iso

#make an image file slightly larger
dd if=/dev/zero of=fbsd.img bs=1k count=40000

#create /dev/md0 connected to the image file
mdconfig -a -t vnode -f fbsd.img -u 0

#lable it and make a file system thereon
bsdlabel -w -B md0 auto
newfs -m 0 md0a

#make a mount point and then mount the new mem fs on it
mkdir img
mount /dev/md0a img
#and check its usage etc etc
df img

#now make a mount point for the iso and connect it to md1
mkdir iso
mdconfig -a -t vnode -f 7.1-RC1-i386-bootonly.iso  -u 1

#and mount as cd
mount_cd9660 /dev/md1 iso
df iso

#copy the iso to the image
cp -pr iso/* img/

#clean up
umount img iso
mdconfig -d -u 0
mdconfig -d -u 1

#copy the image to the target
scp fbsd.img me at target:/tmp/

### target machine ubuntu 8.10 in my case
Now after logging in to the target and sudoing su

mv /tmp/fbsd.img /boot
cp /usr/lib/syslinux/memdisk /boot

then edited /boot/grub/menu.lst to contain a new entry

title FreeBSD
root (hd0,0)
kernel memdisk
initrd /boot/fbsd.img

On reboot I selected the FreeBSD entry and was pleasantly surprised to see the 
freebsd boot process happening just fine. I suppose with this setup (provided 
all stays connected) one can do a full install from a network whose parameters 
may be set up during the install.
Robin Becker

More information about the freebsd-questions mailing list