View Single Post
  #1   (View Single Post)  
Old 14th February 2015
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
Join Date: Oct 2013
Location: EST USA
Posts: 280
Default Installing OpenBSD from a USB flash drive

I wanted to upgrade a 5.5-i386 machine to 5.6-i386 with a fresh installation and a new disk partition layout. There were no blank CD's in the house but there was an old USB thumb drive that might do the trick. The FAQ has a section - Creating a bootable install flash drive from Unix - but I suspect that installation method would require network access. Unfortunately, the target machine's wpi(4) network interface requires an fw_update(1) with non-free firmware before it is usable.

This method creates a bootable USB installation device (yeah, I said "installation device" (hey, it's been a long day)) from the contents of the install56.iso CD image.

First, inspect the USB device:

From $ dmesg
sd1: 247MB, 512 bytes/sector, 506880 sectors

This one is ancient and barely has enough capacity but it will work.

Then as root: (in the following, be sure to replace values in red with values from your USB drive)
vnconfig vnd0 install56.iso
mount /dev/vnd0a /mnt
tar xzf /mnt/5.6/i386/base56.tgz -C /tmp/
dd if=/dev/zero of=disk.img bs=512 count=506880
vnconfig vnd1 disk.img
fdisk -y -f /tmp/usr/mdec/mbr -i vnd1
echo "a\n\n\n\n\nw\nq\n" | disklabel -E vnd1 
newfs /dev/rvnd1a
mkdir /mnt2
mount /dev/vnd1a /mnt2
cp -r /mnt/* /mnt2/
installboot -r /mnt2 vnd1 /tmp/usr/mdec/biosboot /tmp/usr/mdec/boot
dd bs=512 count=506880 if=disk.img of=/dev/rsd1c
umount /mnt
umount /mnt2
vnconfig -u vnd1
vnconfig -u vnd0
rmdir /mnt2
rm disk.img
And that seems to work.
Reply With Quote