Prepare a USB Memstick

Warning

Be extremely careful when writing pfSense® disk images! If the client PC contains other hard drives it is possible to select the wrong drive and overwrite a portion of that drive with the installer disk. This renders the disk completely unreadable except to certain disk recovery programs, if at all.

Connect the USB Memstick to the Workstation

Start by connecting the USB memstick to the workstation containing the installation media image.

Locate the device name that the client PC designates for the drive. The device varies by platform, here are a few examples:

  • Linux: /dev/sdX where X is a lowercase letter. Look for messages about the drive attaching in the system log files or by running dmesg.

  • FreeBSD: /dev/daX where X is a decimal digit. Look for messages about the drive attaching in the system log files or by running dmesg.

  • Windows: the drive will be named after a single uppercase letter, e.g. D. Use Explorer or examine the system control panel and look at the available disks for one matching the drive.

  • On Mac OS X: /dev/diskX where X is a decimal digit. Run diskutil list from a command prompt or use the GUI tool Disk Utility.

    Note

    On Mac OS X, if the disk is named diskX then the device to pass to the writing utility is actually rdiskX which is must faster for these types of low-level operations.

Note

Also make sure the device name refers device itself rather than a partition on the device. For example, /dev/sdb1 on Linux is the first partition on the disk, so it would be writing to a partition on the device and the drive may not end up being bootable. In that case use /dev/sdb instead so the disk image utility writes to the entire disk.

Cleaning the USB Memstick

This step is optional unless the image fails to write to the USB memstick.

The target drive may already contain partitions which can prevent it from being written properly by disk image tools. To get a fresh start, wipe all of the partitions from the disk. This can be done a few different ways in Windows or in UNIX.

Windows

The Disk Management interface in Windows is one way to delete the partitions from a disk but often it has the operation disabled. The simplest and most reliable method is to use diskpart.

  • Start a command prompt (cmd.exe) as Administrator

  • Run diskpart

  • Enter list disk to show the disks connected to the client PC

  • Locate the target USB memstick in the list and note its disk number

  • Enter select disk n where n is the disk number of the target USB memstick from the list in the previous command output

  • Enter clean to remove the partitions from the disk

  • Enter exit to stop diskpart and return to a command prompt

  • Enter exit again to close the command prompt window

Linux, FreeBSD, Mac OS X

The dd command is the easiest way to erase the partition table from the USB memstick on UNIX and UNIX-like operating systems such as Linux, FreeBSD, and OS X.

$ sudo dd if=/dev/zero of=memstick_disk_path bs=1M count=1

Replace memstick_disk_path with the path to the memstick disk device, e.g. /dev/sdb, /dev/da1, or /dev/rdisk3.

Write the Image

Now it is time to write the image to the USB memstick. The exact procedure varies by operating system.

Note

The following instructions assume the installation media image file has been decompressed by an appropriate utility first. For details, see Decompress the Installation Media.

Warning

The operations in this section will completely overwrite any existing content on the USB Memstick! Check the USB memstick first for any files to save or backup.

Linux, FreeBSD, Mac OS X

On Linux, FreeBSD and Mac OSX, write the image to the drive using the dd command. It takes this general form:

dd if=image_file_name of=usb_disk_device_name

Writing to the disk in this way generally requires elevated privileges, so the user writing the image will most likely need to use sudo to run the command.

Example dd disk writing commands:

  • Linux:

    sudo dd if=pfSense-CE-memstick-ADI-2.4.4-RELEASE-p3-amd64.img of=/dev/sdb bs=4M
    
  • FreeBSD:

    sudo dd if=pfSense-CE-memstick-ADI-2.4.4-RELEASE-p3-amd64.img of=/dev/da1 bs=4m
    
  • Mac OSX:

    sudo dd if=pfSense-CE-memstick-ADI-2.4.4-RELEASE-p3-amd64.img of=/dev/rdisk3 bs=4m
    

The bs=X parameter is optional and tells dd to perform reads and writes on 4 MB blocks of data at a time. The default block size used by dd is 512 bytes. Specifying a larger block size can significantly increase the writing speed.

Windows

In order to write an image to a drive from a Windows workstation, use a GUI tool such as Win32 Disk Imager or Rufus. The same Linux dd command listed above can also be used from within Cygwin if the Cygwin command prompt is launched as an Administrator-level user.

Win32 Disk Imager

  • Download and install Win32 Disk Imager

  • Start Win32 Disk Imager as Administrator

  • Click the folder icon

  • Navigate to the location of the decompressed installation media image

  • Select the image

  • Choose the target USB memstick drive from the Device drop-down

  • Click Write

  • Wait for the image to finish writing

Rufus

  • Download and install Rufus

  • Start Rufus as Administrator

  • Choose the target USB memstick drive from the Device drop-down

  • Select DD Image from the drop-down next to Create bootable disk using

  • Click the CD-ROM icon next to Create bootable disk using

  • Navigate to the location of the decompressed installation media image

  • Select the image

  • Click Start

  • Wait for the image to finish writing

Troubleshooting

If writing the disk fails, especially on Windows, clean the USB memstick as suggested in Cleaning the USB Memstick then try again. If it still fails, try a different USB memstick.