Monday, October 15, 2018

boot - How to write FreeBSD image to USB flash drive


I am trying to write FreeBSD-10.3-RELEASE-amd64-memstick.img to a USB flash drive, in the hopes of installing FreeBSD on an x64 computer in my house. Here is the image: ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.3/.


I have searched up how to write .img files to a USB flash drive, with most sites saying to use Unetbootin, Startup Disk Creator, or the dd command. When I plugged in and selected the flash drive after using Unetbootin, I received the message "Missing operating system". With Disk Creator, I received a message telling me that Disk Creator couldn't write the image to the flash drive.


As for the dd command, I used this: dd if=FreeBSD-10.3-RELEASE-amd64-memstick.img of=/dev/sdb1 bs=10240 conv=sync, which I got from here and here. The command writes a bunch of garbage files to my flash drive, instead of the contents of the FreeBSD image (which I assume wouldn't be garbage files).


How should I go about writing FreeBSD to the flash drive and installing it to my computer, given that these options didn't work?


Answer



Assuming you are using dd within FreeBSD or Linux:


Using Linux:


1) umount /dev/sdb


If your USB stick is under /dev/sdb


2) dd if=FreeBSD-10.3-RELEASE-amd64-memstick.img of=/dev/sdb bs=10240


Using (Free)BSD:


1) umount /dev/da0


If your USB stick is under /dev/da0


2) dd if=FreeBSD-10.3-RELEASE-amd64-memstick.img of=/dev/da0 bs=1m


Please note the of=/dev/sdb argument as you are supposed to write to the whole stick instead of its first partition.


The same is true of of=/dev/da0. But please note that da is typically the prefix for USB port devices on (Free)BSD. Which means that it might just as well be da1. So make sure to check beforehand. :)


Easiest way would be to compare the results of an ls /dev before and after plugging/unplugging your flash drive/USB stick.


3) Now reboot and choose the USB stick as the boot option.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...