Wednesday, January 31, 2018

FreeBSD in GCE

Yes there are supported images of amd64 freebsd available in GCE to boot, but I needed an i386 variant so here are the steps I took.


I downloaded the mini memstick image, converted it to a disk format virtualbox recognised

VBoxManage.exe convertfromraw FreeBSD-11.1-RELEASE-amd64-mini-memstick.img FreeBSD-11.1-RELEASE-amd64-mini-memstick.vdi  --format vdi

Then made a virtual machine with that as it's disk, booted and chose the shell option, then remounted as read/write, and put this into /boot/loader.conf

mount -o rw /dev/ufs/FreeBSD_install /

boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole,vidconsole"

then shutdown the machine (gracefully!)

now I have an image that supports install via a serial port, just need to make it the right format for GCE to consider as a boot disk

VBoxManage.exe clonehd FreeBSD-11.1-RELEASE-amd64-mini-memstick.vdi disk.raw --format raw

tar -Sczf /tmp/compressed-image.tar.gz disk.raw

now put compressed-image.tar.gz in a bucket and create an image from it.

create a virtual machine with this as the primary disk and a 20GB second disk. Boot , and connect serial port , and install to the second disk.  before finishing the install make sure you update fstab on the second disk, so it can be used as a primary disk.

lastly fixup your nic MTU

ifconfig_vtnet0="SYNCDHCP mtu 1460"


No comments: