# Writing an OS Installation Image to Flash Media¶

Flash Media includes:

• USB drives
• Compact Flash cards
• SD cards
• Micro SD cards

Download an installation image file from the appropriate location to a workstation from which the file will be written.

Make sure to choose the version of the image for the correct architecture. Most operating systems use either amd64 or x86_64 as the designation to represent the 64-bit architecture used by most modern processors. The 32-bit predecessor of this is usually designated i386.

Verify that the download succeeded by verifying the hash of the image file. The download site will likely have a file with sha256 or md5 in the filename. Many times this is in the same HTTP or FTP directory from which the original image was retrieved. The hash of the downloaded file may be calculated and that value compared against the hash that the project specified.

Hash calculation programs vary by operating system, some common examples include:

• Windows: The HashTab application.
• Linux and Cygwin (Windows): sha256sum or md5sum command line utilities
• FreeBSD and Mac OSX: sha256 or md5 command line utilities

If the downloaded image was compressed , before proceeding to the next steps, decompress it using an appropriate utility such as 7-Zip, gunzip or bunzip2.

The most common indication that a file is compressed is its extension. If the filename ends in .gz, .bz2, .zip, or similar then it is likely compressed.

## Connect the Flash Drive to the Workstation¶

Start by connecting the drive to the workstation where the downloaded image resides.

Locate the device name that the system designates for the drive. Here are some pointers for what the device name may look like on different platforms:

• 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 located 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 entire disk is written.

## Write the Image¶

Now it is time to write the image to the flash drive. The exact procedure varies by Operating System.

Warning

The operations in this section will completely overwrite any existing content on the flash drive so be sure that any files previously stored on the drive are backed up elsewhere.

### 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


Some examples for different platforms:

• Linux:

sudo dd if=file1.img of=/dev/sdb bs=4M

• FreeBSD:

sudo dd if=file1.img of=/dev/da1 bs=4m

• Mac OSX:

sudo dd if=file1.img of=/dev/rdisk3 bs=4m


The bs=X 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 which will result in faster image writing.

### Windows¶

In order to write an image to a drive from a Windows workstation, use a GUI tool such as Etcher. It is possible to use the same Linux dd command listed above within Cygwin if the Cygwin command prompt is launched as an Admin user. You can also use Win32 Disk Imager or Rufus.