# [GELI] Doesn't boot from USB



## grotesmurf (Jan 29, 2010)

Hi, I am trying to setup FreeBSD 8 with full disk encryption using GELI inside a VM. However I seem to fail in creating a proper USB boot disk.

My situation is as follows: my VM only supports booting from HD, ISO or floppy image (raw image). I am trying to build a proper floppy image in order to boot my encrypted harddisk. I want to divide the harddisk in one 9GB / partition and a 1G swap space (harddisk is da0).

Maybe someone knows what I am missing. Here are my steps (using the installation DVD:


```
First start a fixme terminal from the CD.
# ln -s /dist/boot/kernel /boot/kernel
# ln -s /dist/lib /lib
# kldload geom_geli
# kldload geom_md
# kldload geom_mbr
# geli init -b -e aes -l 256 /dev/da0
# geli attach /dev/da0
# bsdlabel -w /dev/da0.geli
# bsdlabel -e /dev/da0.geli
a: 9G 16 4.2BSD 0 0 0
b: *  *  swap
c: (untouched)

# newfs /dev/da0.gelia
# mkdir /mnt/hd
# mkdir /mnt/img
# mount /dev/da0.gelia /mnt/hd
# export DESTDIR=/mnt/hd
# cd /dist/8.0-RELEASE/base
# ./install.sh
# cd /dist/8.0-RELEASE/kernels
# ./install.sh GENERIC
```

Now my base system should be ready right? So now I want to create the boot image:

```
# cd /mnt/hd (some place to fit the image)
# truncate -s 400M boot.img
# mdconfig -f boot.img
# fdisk -BI /dev/md1
# bsdlabel -B -w /dev/md1a
# newfs /dev/md1a0
# mount /dev/md1a0 /mnt/img
# cp -Rpv /mnt/hd/boot /mnt/img
# rm -rf /mnt/img/boot/kernels
# mv /mnt/img/boot/GENERIC /mnt/img/boot/kernel
# echo "geom_eli_load=\"YES\"" >> /mnt/img/boot/loader.conf
# mkdir /mnt/img/etc
# echo "/dev/da0.elia / ufs rw 1 1" > /mnt/img/etc/fstab
# echo "/dev/da0.elib none swap sw 0 0" >> /mnt/img/etc/fstab
# mdconfig -d -u md1
```
So now I should have a bootable image. Only it doesn't boot . So apparently I'm missing something.


----------

