Writing FreeBSD, DragonFly, other BSD’s images to USB in Linux

First, we should prepare our USB device. We need to backup all the files we want to save because after writing FreeBSD to the USB drive they will be lost. It doesn’t require additional actions like format USB or make partitions and filesystems on it. FreeBSD image file already have all partitions and filesystems on it. Take a look:

sudo fdisk -l FreeBSD-12.0-RELEASE-amd64-memstick.img
Device                                                                        Boot Start      End         Sectors     Size           Id      Type
FreeBSD-12.0-RELEASE-amd64-memstick.img1          1     1600          1600       800K         ef      EFI (FAT-12/16/32)
FreeBSD-12.0-RELEASE-amd64-memstick.img2 *     1601 753616    752016    367.2M      a5     FreeBSD

So here are two partitions. First is a boot partition, and the next with the FreeBSD installation program.

Get installation image

First follow to FreeBSD download page. There are descriptions of all versions. We can read about each and choose the desired one.

Select the version for your processor architecture. The file name looks like this:


Memstick images are for USB devices. So it is right to get them. There are also mini-memstick images which in 3 times less in size, but they may not contain enough drivers for our devices. So it is better to use full memstick image.

DragonFly, OpenBSD, NetBSD and others

The installation process is the same for them. I found errors in their documentation because they may have outdated information.

For example, many of them use bs=1m as a parameter in dd utility. But in modern versions of dd it is required to use upper letter bs=1M to tell dd it is in megabytes size.

Here is what I found in DragonFly BSD installation documentation:

# dd if=dfly-x86_64-*_REL.img of=/dev/sd8 bs=1m

But it is not correct! It is right to use bs=1M in modern dd versions. And more! The use of of=/dev/sd8 is also isn’t correct because BSD images already have all partitions on them and it is required to copy images in first blocks of the device, therefore the right use of this is something like of=/dev/sdc. Then BIOS can boot correctly from such a USB device.

Many of BSD systems use .img file extension for USB images, but OpenBSD use .fs image extension. Be careful with that!


Now we know how it works and we can burn FreeBSD image to a USB device. Make sure the USB device is inserted into the port. Then we need to determine how the kernel called the device. We can do it with the following command:

ls -l /dev/disk/by-id/ | grep usb
usb-Verbatim_0302_12011408023397-0:0 -> ../../sdc

Now we know that it presented in Linux kernel as /dev/sdc.

Writing FreeBSD image to USB

Make sure you backup all the necessary files from USB.

Let’s start the writing process. Use the following command (don’t forget to replace the image and device name with your own):

sudo dd if=FreeBSD-12.0-RELEASE-amd64-memstick.img of=/dev/sdc bs=1M conv=sync

It will take some time. After the process is finished, we can make sure that everything is correct. All partitions in a right place:

sudo fdisk -l /dev/sdc
Device     Boot Start     End Sectors   Size Id Type
/dev/sdc1           1    1600    1600   800K ef EFI (FAT-12/16/32)
/dev/sdc2  *     1601 1906064 1904464 929.9M a5 FreeBSD

Now we can boot from this USB through BIOS and proceed with the installation.