Memory Stick (USB Drive)

To create a bootable FreeBSD USB drive (a/k/a memory stick) using a Windows system, first download dd for Windows. Then set your default directory to the one that contains the FreeBSD memory stick image and copy the image to the memory stick using a command like this:

c:\apps\dd-0.6beta3\dd if=FreeBSD-8.1-RELEASE-amd64-memstick.img of=\\?\Device\Harddisk3\Partition0 bs=10240 --progress --filter=removable

The --filter option is not required but is a good idea to help ensure that the wrong disk is not written to. The removable value means that the output device must be a removable drive, and since we are writing to a memory stick then that’s a useful check to make.

You may now boot from this USB drive, right into FreeBSD!

Access is Denied

Sometimes while writing to a memory stick this error occurs:

Error writing file: 5 Access is denied

I’ve fixed this with the diskpart utility as follows:

diskpart

select disk n

clean

exit

Then the dd utility is able to write to the memory stick.

Determining Disk Partition Name

Press the Windows+R keys, enter msinfo32 in the Open field, then press the Enter key.

In the msinfo32 utility, expand the Components node, then the Storage node, then highlight the Disks node. In the right hand part of the window, look for the stick drive. Once located, the Partition field will show the disk and partition numbers like so:

Disk #7, Partition #0

In this example, you would set the of option to the dd utility as follows:

\\?\Device\Harddisk7\Partition0

Be very careful determining the disk and partition numbers. The msinfo32 utility does not make it easy to match up a disk entry shown with the actual memory stick that is plugged in. It doesn’t even show the label of the stick that is currently plugged in. Check the Media Type field and make sure it shows Removable media for the entry you believe to be the memory stick.

Also, verify the disk number and partition number with the diskpart utility:

diskpart

list disk

select disk n

list partition

References