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¶
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 the Downloaded Image¶
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):
md5sumcommand line utilities
- FreeBSD and Mac OSX:
md5command line utilities
Decompress the Downloaded Image¶
If the downloaded image was compressed , before proceeding to the next steps,
decompress it using an appropriate utility such as 7-Zip,
The most common indication that a file is compressed is its extension. If the
filename ends in
.zip, or similar then it is likely
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
FreeBSD: /dev/daX where X is a decimal digit. Look for messages about the drive attaching in the system log files or by running
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 listfrom a command prompt or use the GUI tool Disk Utility.
On Mac OS X, if the disk is named
diskXthen the device to pass to the writing utility is actually
rdiskXwhich is must faster for these types of low-level operations.
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.
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:
sudo dd if=file1.img of=/dev/sdb bs=4M
sudo dd if=file1.img of=/dev/da1 bs=4m
sudo dd if=file1.img of=/dev/rdisk3 bs=4m
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.